I am trying to use SetWindowHookEx() API to inject my code into another process, but I am kinda lost with the hook procedure that should be placed in the .dll file
is there an explaination about how to build a hook procedure?
as you can see I am trying to do a mouse hook, this try is to get any right click, but later when I get it to work, I want it to be for a defined application that when it gets right click the the popup pops up
If you really want a global hook (specifying 0 as last arg to SetWindowHookEx), the hook proc must reside in a DLL.
I'm not sure how you have setup everything... Have you exported the MouseProc function? (ie does GetProcAddress work?) Check every return values when installing the hook.
I wrote a simple test in C with VC2003... see attachment.
Hi All,
If we want a global hook (specifying the thread id of the process whose keyboard and mouse inout we want to block as last arg to SetWindowHookEx), then where the hookproc must reside, will it be a part of dll or will it be a part of exe .
By the way, never could understand those plays with LoadLibrary and GetProcAddress, though this point is most common in the samples I saw, here and there. Personally me typically place the SetWindowsHookEx call into dll and link to the latter by means of import library with no problem.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.