simplified WinEvents

Post your working scripts, libraries and tools
User avatar
KuroiLight
Posts: 327
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

simplified WinEvents

10 Jan 2018, 20:54

I tried to simplify SetWinEventHook as much as I could for ease of usage. May expand it later.
You can set a WinEvent hook for any of the available events without the min/max range requirement.
You can add events to a callbacks hook after initial usage and remove events from the hook without removing all of them.

To Add an event hook use:
HookEvent(functionname, events, pid := "0", flags := "0")
functionname is a string name of the function, processId filter and dwflags optional, events must be an array of event constants (listed in WinEvents.ahk)
the function specified by function name must have the definition like: WinEventProc(hHook, event, hwnd, idObject, idChild, dwEventThread, dwmsEventTime)
To remove an event hook use:
UnHookEvent(functionname, events)
params same as above

WinEvents.ahk:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Eample Usage:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by KuroiLight on 10 Jan 2018, 20:58, edited 2 times in total.
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]
01/24/18
guest3456
Posts: 2329
Joined: 09 Oct 2013, 10:31

Re: simplified WinEvents

10 Jan 2018, 20:56

haven't tried it, but looks like nice work

AHKStudent
Posts: 249
Joined: 05 May 2018, 12:23

Re: simplified WinEvents

22 May 2018, 21:53

KuroiLight wrote:I tried to simplify SetWinEventHook as much as I could for ease of usage. May expand it later.
You can set a WinEvent hook for any of the available events without the min/max range requirement.
You can add events to a callbacks hook after initial usage and remove events from the hook without removing all of them.

To Add an event hook use:
HookEvent(functionname, events, pid := "0", flags := "0")
functionname is a string name of the function, processId filter and dwflags optional, events must be an array of event constants (listed in WinEvents.ahk)
the function specified by function name must have the definition like: WinEventProc(hHook, event, hwnd, idObject, idChild, dwEventThread, dwmsEventTime)
To remove an event hook use:
UnHookEvent(functionname, events)
params same as above

WinEvents.ahk:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Eample Usage:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Is there a way to use this script to detect anytime WM_GETTEXT is called and to report back the process that called it?

Thank you
User avatar
KuroiLight
Posts: 327
Joined: 12 Apr 2015, 20:24
GitHub: KuroiLight

Re: simplified WinEvents

23 May 2018, 23:12

AHKStudent wrote:
Is there a way to use this script to detect anytime WM_GETTEXT is called and to report back the process that called it?

Thank you

been a while since I touched this, but as far as I know not unless the WM_GETTEXT message is being sent to the process that is running this code.
Windows 10, Ryzen 1600, 16GB G.Skill DDR4, 8GB RX 480 | [MyScripts][MySublimeSettings] [Unlicense][MIT License]

01/24/18


Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 15 guests