!---------------------------------------------------------------------------------------------- OnAlertKey PROCEDURE(TheKey) VK_SHIFT EQUATE(10h) VK_CONTROL EQUATE(11h) VK_MENU EQUATE(12h) VK_CAPITAL EQUATE(14h) KEYEVENTF_KEYUP EQUATE(2) pCode STRING(20) IsShift BYTE IsCtrl BYTE IsMenu BYTE !Alt CODE CASE TheKey OF UpKey OROF LeftKey pCode = ShiftTab OF DownKey OROF RightKey OROF EnterKey OROF TabKey pCode = TabKey END IF BAND(KEYSTATE(),0100h) IsShift = True END IF BAND(KEYSTATE(),0200h) IsCtrl = True END IF BAND(KEYSTATE(),0400h) IsMenu = True END IF NOT CLIP(pCode) = '' IF NOT TheKey = TabKey IF BAND(100h,pCode) ! If the shift key is needed, KeyBd_Event(VK_SHIFT, MapVirtualKeyA(VK_SHIFT, 0), 0, 0) ! press and hold the shift key END IF BAND(200h,pCode) ! If the Control key is needed, KeyBd_Event(VK_CONTROL, MapVirtualKeyA(VK_CONTROL, 0), 0, 0) ! press and hold the control key END IF BAND(400h,pCode) ! If the Alt key is needed, KeyBd_Event(VK_MENU, MapVirtualKeyA(VK_MENU, 0), 0, 0) ! press and hold the alt key END ELSE KeyBd_Event(VK_SHIFT, MapVirtualKeyA(VK_SHIFT, 0), KEYEVENTF_KEYUP, 0) ! Release Shift Key if appropriate KeyBd_Event(VK_CONTROL, MapVirtualKeyA(VK_CONTROL, 0), KEYEVENTF_KEYUP, 0) ! Release Control key if appropriate KeyBd_Event(VK_MENU, MapVirtualKeyA(VK_MENU, 0), KEYEVENTF_KEYUP, 0) ! Release alt key if appropriate END KeyBd_Event(BAND(pCode,0FFh), MapVirtualKeyA(BAND(pCode,0FFh), 0), 0, 0) ! Press and release the unshifted, uncontrolled, KeyBd_Event(BAND(pCode,0FFh), MapVirtualKeyA(BAND(pCode,0FFh), 0), KEYEVENTF_KEYUP, 0) ! unalted key IF NOT TheKey = TabKey IF BAND(100h,pCode) KeyBd_Event(VK_SHIFT, MapVirtualKeyA(VK_SHIFT, 0), KEYEVENTF_KEYUP, 0) ! Release Shift Key if appropriate END IF BAND(200h,pCode) KeyBd_Event(VK_CONTROL, MapVirtualKeyA(VK_CONTROL, 0), KEYEVENTF_KEYUP, 0) ! Release Control key if appropriate END IF BAND(400h,pCode) KeyBd_Event(VK_MENU, MapVirtualKeyA(VK_MENU, 0), KEYEVENTF_KEYUP, 0) ! Release alt key if appropriate END ELSE IF IsShift KeyBd_Event(VK_SHIFT, MapVirtualKeyA(VK_SHIFT, 0), 0, 0) ! press and hold the shift key END IF IsCtrl KeyBd_Event(VK_CONTROL, MapVirtualKeyA(VK_CONTROL, 0), 0, 0) ! press and hold the control key END IF IsMenu KeyBd_Event(VK_MENU, MapVirtualKeyA(VK_MENU, 0), 0, 0) ! press and hold the alt key END END END RETURN