Posts: 98
Threads: 46
Joined: Oct 2008
I have 4 macros to be used on online trading terminals. I have made 4 EXE files of them. Now problem with EXE is that they pick only desktop shortcut key triggers. Is there any better way for keyboard triggers in EXE mode as I also tried KT2 triggers of FORUM but that too failed. As an alternative I am using hotkeyp freeware for assigning shortcut keys to my EXE and exceute. Can I make some program in QM which shall load at windows startup and take care for keyboard triggers as I am getting from hotkeyp.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Use RegisterHotKey function. Documented in the MSDN library. You also need a hidden window that will receive WM_HOTKEY messages.
Posts: 98
Threads: 46
Joined: Oct 2008
I tried to figure out with Registerkey but was unable to do so. Could you please provide a piece code using Registerkey. It's urgent for me.
Posts: 12,073
Threads: 140
Joined: Dec 2002
This is one of you can find in the forum:
Please "eat" my media keys
Posts: 98
Threads: 46
Joined: Oct 2008
The example of Registerkey works fine but a small glitch whenever the dialog box is closed it stops working. I want that once started it should not display any window and it could be stopped only after restart. Also can I share some variable in different macro in EXE mode.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Windowless example.
Macro
int hk1=1
RegisterHotKey 0 hk1 MOD_ALT|MOD_CONTROL VK_F2
MSG m
rep
,if(GetMessage(&m 0 0 0)<1) break
,
,sel m.message
,,case WM_HOTKEY
,,if(m.wParam=hk1)
,,,mes "hotkey 1"
,,
,TranslateMessage &m
,DispatchMessage &m
UnregisterHotKey 0 hk1
To share variables between two exe processes can be used registry (rset/rget). It is easiest.
Posts: 98
Threads: 46
Joined: Oct 2008
It's working fine, just one query when & how will this macro end.
Posts: 12,073
Threads: 140
Joined: Dec 2002