Clay,
Thats just what the doctor orded - Perfect thx
------------------
Kind Regards
Mike
Announcement
Collapse
No announcement yet.
Detecting CTRL key held down
Collapse
X
-
DIM L1 AS LONG
L1 = GetAsyncKeyState(%VK_CONTROL)
L1 will be FALSE if the key hasn't been pressed since the last
call to the function. For other settings, refer to the Win32
Hlp file for the function.
------------------
Clay C. Clear
mailto:[email protected][email protected]</A>
Home Page
Leave a comment:
-
-
Mike:
Is this what you mean?Code:#COMPILE EXE #INCLUDE "WIN32API.INC" GLOBAL hDlg AS LONG GLOBAL StopKBHook AS LONG CALLBACK FUNCTION DlgProc SELECT CASE CBMSG CASE %WM_DESTROY StopKBHook = %TRUE PostQuitMessage 0 END SELECT END FUNCTION FUNCTION PBMAIN DIALOG NEW 0, "Catch Ctrl Key",,, 100, 50, %WS_CAPTION + %WS_SYSMENU TO hDlg CONTROL ADD LABEL, hDlg, 100, "Press Ctrl ...", 30, 10, 40, 10 CONTROL ADD LABEL, hDlg, 200, "", 30, 25, 40, 10, %SS_SUNKEN + %SS_CENTER DIALOG SHOW MODELESS hDlg CALL DlgProc CALL KBHook END FUNCTION SUB KBHook LOCAL Msg AS tagMsg WHILE GetMessage(Msg, hDlg, 0, 0) = %TRUE SELECT CASE Msg.message CASE %WM_KEYDOWN IF ISTRUE(LOWRD(GetKeyState(%VK_CONTROL)) AND &H8000) THEN CONTROL SET TEXT hDlg, 200, "CTRL" END IF CASE %WM_KEYUP IF ISFALSE(LOWRD(GetKeyState(%VK_CONTROL)) AND &H8000) THEN CONTROL SET TEXT hDlg, 200, "" END IF END SELECT IF IsDialogMessage(hDlg, Msg) = %FALSE THEN TranslateMessage Msg DispatchMessage Msg END IF IF StopKBHook = %TRUE THEN EXIT LOOP LOOP END SUB
Leave a comment:
-
-
Detecting CTRL key held down
I guess I should start a new thread for this,
I want to be able to set a flag if my program detects the
CTRL key on the keyboard while looping through a section
of my code.
I have read the POffs forum for 3 hrs and the other thread on
Hooking the keybosrd chars, but I dont want CTRL + Something,
i just want the CTRL (or ALT i guess)
Is there a simple way to do this?
------------------
Kind Regards
MikeTags: None
-
Leave a comment: