Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keyboard hook
#2
does your executable have a dialog?
there are a few options depending on yes or no

have a look in the archive file
http://www.quickmacros.com/forum/showthr...p?tid=2852
lots of examples 

here are a couple
Function __RegisterHotKey_example
Code:
Copy      Help
;Shows how to use __RegisterHotKey to use hotkeys in a windowless thread.
;This should be function, not macro, because runs all the time.

__RegisterHotKey hk1.Register(0 1 MOD_CONTROL|MOD_SHIFT VK_F5)
;also can register more hotkeys, for example
__RegisterHotKey hk2.Register(0 2 MOD_CONTROL 'B')
;...

MSG m
rep
,if(GetMessage(&m 0 0 0)<1) break
,sel m.message
,,case WM_HOTKEY
,,sel m.wParam
,,,case 1 ;;Ctrl+Shift+F5 pressed
,,,mac "Function_that_does_something_on_Ctrl_Shift_F5"
,,,out "Ctrl+Shift+F5
,,,case 2
,,,out "Ctrl+B"
,,,
,,,;...
,,,
,DispatchMessage &m

Function dialog_hotkeys
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030506 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0)) ret


#sub DlgProc
function# hDlg message wParam lParam
__RegisterHotKey- t_hk1 t_hk2
sel message
,case WM_INITDIALOG
,t_hk1.Register(hDlg 1 MOD_CONTROL|MOD_SHIFT VK_F5) ;;Ctrl+Shift+F5
,t_hk2.Register(hDlg 2 MOD_ALT|MOD_WIN 'Q') ;;Alt+Win+Q
,
,case WM_HOTKEY
,sel wParam
,,case 1 out "Ctrl+Shift+F5"
,,case 2 out "Alt+Win+Q"
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

and many more in archive file
easiest would be to add a function like one of these or others and rebuild your exe


Messages In This Thread
Keyboard hook - by InterestedNewbie - 04-25-2018, 01:21 AM
RE: Keyboard hook - by Kevin - 04-25-2018, 03:50 AM
RE: Keyboard hook - by InterestedNewbie - 04-25-2018, 06:58 PM
RE: Keyboard hook - by Kevin - 04-26-2018, 12:02 AM
RE: Keyboard hook - by InterestedNewbie - 04-26-2018, 12:24 AM
RE: Keyboard hook - by InterestedNewbie - 04-28-2018, 08:58 PM
RE: Keyboard hook - by Kevin - 04-28-2018, 09:12 PM
RE: Keyboard hook - by InterestedNewbie - 04-29-2018, 03:19 AM
RE: Keyboard hook - by Kevin - 04-29-2018, 04:48 AM
RE: Keyboard hook - by InterestedNewbie - 04-29-2018, 04:01 PM
RE: Keyboard hook - by Gintaras - 04-29-2018, 05:13 PM
RE: Keyboard hook - by InterestedNewbie - 04-29-2018, 08:25 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)