08-09-2013, 02:53 PM
Let other macro post a message to this thread. If using message loop like in previous example, other macro must know thread id. Probably easier to use a hidden dialog instead.
Function dialog_register_hotkey_from_other_macro
Macro Macro2122
Function dialog_register_hotkey_from_other_macro
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("" &dialog_register_hotkey_from_other_macro 0 0 128)) ret
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "dialog_register_hotkey_from_other_macro"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030601 "*" "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,__RegisterHotKey- hk1.Register(hDlg 1 MOD_CONTROL|MOD_SHIFT VK_F5)
,
,case WM_APP+177
,out "unregister/register hotkey here"
,
,case WM_HOTKEY
,sel wParam
,,case 1
,,out "Ctrl+Shift+F5 pressed"
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1