I'm trying to replace the "SetWinEventHook" DllCall for "SetWindowsHookEx" to only register Top Window Creation events.
Reason:
Spoiler
So I've checked for RegisterShellHookWindow and prefered SetWindowsHookEx because the first is mentionned to possibly stop working in later Window versions. Quote Microsoft:
Spoiler
Can you please help me make that DllCall so that SetWindowsHookEx actualy works.
Here is what I have so far - which isn't working:
Code: Select all
; Refer to:
; - https://docs.microsoft.com/fr-fr/windows/win32/api/winuser/nf-winuser-setwindowshookexa
; - https://www.autohotkey.com/boards/viewtopic.php?t=18813
; - https://autohotkey.com/board/topic/71347-setwindowshookex-fails/
;
; Used Microsoft constants in this DllCall :
; - WH_SHELL := 10
;
; PS: my system is a 64-bits process
hWinEventHook := DllCall("SetWindowsHookEx"
, "Int", 10 ; idHook of type int := WH_SHELL := 10
, "Ptr", RegisterCallback("OnWH_SHELL") ; lpfn of type HOOKPROC ???
, "Ptr", 0 ; hmod of type HINSTANCE ???
, "Ptr", ProcessID) ; dwThreadId of type DWORD ???
;--------------------------------------------------------------------------------
OnWM_SHELL(nCode, wParam, lParam) {
;--------------------------------------------------------------------------------
; Handle Callbacks on Sage.exe ProcessID
Tooltip %A_TickCount%`n%nCode%`n%wParam%`n%lParam%
}
Spoiler
Thanks