-
April 30th, 2009, 04:33 PM
#1
Hooking a local window SetWindowsHookEx
Hi,
I am experimenting with hooking and have read teh ms docs on installing a WH_CBT hook.
My question is, I am in the address space of a program and want to set a CBT hook on a local window. For a case in point, I have an instance of notepad running, my dll is in the memory space of this process and I want to install a cbt hook on the window. I have its process ID, but I want to inform the setup procedure that the dll with the desired callback method is 'this' one:
Its states in the docs that if you initialise the 3rd parameter to NULL the it should work, but it does not appear to! Any help?
HWND hParent = ::FindWindow(NULL, _T("Untitled - Notepad"));
DWORD pid;
GetWindowThreadProcessId(hParent, &pid);
hcbthook = SetWindowsHookEx(WH_CBT, CBTProc, NULL, pid);
It compiles and runs, but the CBTProc is not being called at the correct moment, well not at all!
I am actually getting a 0x00000000 {unused=???} error 'cannot be evaluated' which of course is no help!
Is this because I wrote the dll in ms vs 2008?
Thanks, r
Last edited by flavour404; April 30th, 2009 at 05:23 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|