06-24-2020, 08:43 PM
Is this a correct way to include this into a QM dialog?
I wanted to stopĀ exe_window_trigger after de the QM dialog ee exits/ends.
I works perfectly, but I wanted to know if this is a correct way doing it.
(I declared hDlg thread global and used it in de exe_window_trigger function.)
Function ee
Function exe_window_trigger
I wanted to stopĀ exe_window_trigger after de the QM dialog ee exits/ends.
I works perfectly, but I wanted to know if this is a correct way doing it.
(I declared hDlg thread global and used it in de exe_window_trigger function.)
Function ee
int hh=SetWinEventHook(EVENT_SYSTEM_FOREGROUND EVENT_SYSTEM_FOREGROUND 0 &exe_window_trigger 0 0 WINEVENT_OUTOFCONTEXT)
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""
if(!ShowDialog(dd &sub.DlgProc 0)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,,int- main_dlg;main_dlg=hDlg
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
Function exe_window_trigger
function hHook event hwnd idObject idChild dwEventThread dwmsEventTime
int- main_dlg
if getopt(nargs)!=7
,int hh=SetWinEventHook(EVENT_SYSTEM_FOREGROUND EVENT_SYSTEM_FOREGROUND 0 &exe_window_trigger 0 0 WINEVENT_OUTOFCONTEXT)
,if(!main_dlg)end
,if(!hh) end F"{ERR_FAILED}. {_s.dllerror}"
,opt waitmsg 1
,wait -1
,UnhookWinEvent hh
,ret
;This code runs whenever a window activated.
outw hwnd
;if wintest(hwnd ...)
;,clo hwnd