|
-
June 1st, 2004, 07:21 AM
#1
SetWindowsHookEx - Controlling other process?
Hey, all. I'm trying to hook another GUI process so I can alter the data in some edit boxes.
I have the window handle of the app, and i have the PID of the app, retrieved with
Code:
GetWindowThreadProcessId();
The problm I have is, SetWindowsHookEx() wants a Thread ID, not a process ID. In other words, this code fails with error 87, BAD_PARAM:
Code:
GetWindowThreadProcessId(hDlg, &pid);
sg_hHook = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)pHookProc, hRes, pid);
if (sg_hHook == NULL)
{
// Process error
}
But this code passes:
Code:
sg_hHook = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)pHookProc, hRes, GetCurrentThreadId());
if (sg_hHook == NULL)
{
// Process error
}
But then my app just hooks itself 
So, is there a way to convert that PID iinto a Thread ID? Or, is there a better way to meddle with another applications edit controls?
Thanks,
-Joe
Intellivision is still where it's at 
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
|