philou
Joined: 26 Jul 2006 Posts: 49 Location: Wuppertal
|
Posted: Wed Jan 23, 2008 12:17 pm Post subject: Window Creation Hook |
|
|
Hey Guys,
I need a way to catch the creation of an open/save dialog, without having to use a timer.
I tried to utilize portions of majkinetor's docking script, but this was merely some fooling around.
I also had a look at the wineventhook.dll, but not in-depth and I'd rather use an all-ahk method
It seems there's a fitting WinEvent:
| Quote: | EVENT_OBJECT_CREATE
An object has been created. The system sends this event for the following user interface elements: caret, header control, list view control, tab control, toolbar control, tree view control, and window object. Server applications send this event for their accessible objects.
Servers must send this event for all of an object's child objects before sending the event for the parent object. Servers must ensure that all child objects are fully created and ready to accept IAccessible calls from clients when the parent object sends this event.
Because a parent object is created after its child objects, clients must make sure that an object's parent has been created before calling IAccessible::get_accParent, particularly if in-context hook functions are used.
|
WinEventProc returned an event (32768) on most occasions,
but I don't understand how to go on, or how to check which window sent the event, etc.
Any help?
Edit: Here's my attempt so far:
| Code: | Dock_HostID := WinExist("ahk_class #32770")
Dock_hookProcAdr := RegisterCallback("Dock_HookProc")
Dock_hHook3 := API_SetWinEventHook(0x8000,0x8000,0,Dock_hookProcAdr,0,0,0) ; EVENT_OBJECT_CREATE
If !Dock_hHook3
API_UnhookWinEvent(Dock_hHook3)
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
API_SetWinEventHook(eventMin, eventMax, hmodWinEventProc, lpfnWinEventProc, idProcess, idThread, dwFlags) {
DllCall("CoInitialize", "uint", 0)
return DllCall("SetWinEventHook", "uint", eventMin, "uint", eventMax, "uint", hmodWinEventProc, "uint", lpfnWinEventProc, "uint", idProcess, "uint", idThread, "uint", dwFlags)
}
API_UnhookWinEvent( hWinEventHook ) {
return DllCall("UnhookWinEvent", "uint", hWinEventHook)
}
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dock_HookProc(hWinEventHook, event, hwnd, idObject, idChild, dwEventThread, dwmsEventTime ) {
global
ToolTip, %event%
}
|
Last edited by philou on Wed Jan 23, 2008 4:58 pm; edited 1 time in total |
|