Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I found this extract in the 'remarks' section of the documentation for SetWindowsHookEx function ("https://msdn.microsoft.com/en-us/library/windows/desktop/ms644990(v=vs.85).aspx"):

"To hook all applications on the desktop of a 64-bit Windows installation, install a 32-bit global hook and a 64-bit global hook, each from appropriate processes, and be sure to keep pumping messages in the hooking application to avoid blocking normal functioning. If you already have a 32-bit global hooking application and it doesn't need to run in each application's context, you may not need to create a 64-bit version. "

I am unable to understand the portion I have highlighted in Bold. I am new to WinApi's and so I may lack some level of understanding. Any idea as to what kind of messages we are supposed to pump.

What I have tried:

By pumping messages, do they mean the following loop:
while (GetMessage(&msg, NULL, 0, 0) > 0) {
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
Posted
Updated 13-Nov-17 9:25am

1 solution

All it means is that any messages your hookProc code gets passed into it should be passed to the next hook in the chain using CallNextHookEx. You can find an example of that here[^] in globalKeyboardHook.cs.

Usually, you don't modify the values you get passed into your hookProc, but there's nothing that says you can't modify the messages before you pass them or filter some out by not passing them at all. Keep in mind that this would mean your app doesn't really "play nice" with other apps or even the system itself.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900