|
-
November 19th, 2010, 09:39 AM
#1
Changing Window Procedure
Hi
Is this code for changing an application's window procedure correct , cuz im having trouble with it
Code:
while(TRUE)
{
hwnd = GetForegroundWindow();
if((WNDPROC)GetWindowLong(hwnd,GWL_WNDPROC) != NULL)
OldWindowProc = (WNDPROC)GetWindowLong(hwnd,GWL_WNDPROC);
SetWindowLong(hwnd,GWL_WNDPROC,(LONG)fakeWinProc);
Sleep(5000);
}
-
November 20th, 2010, 09:14 PM
#2
Re: Changing Window Procedure
cuz im having trouble with it
What's the trouble ?
-
November 21st, 2010, 01:35 AM
#3
Re: Changing Window Procedure
well basically i want to log all keystroke events...
From the debugger it is evident that i get the foreground window... (a call to showwindow(hwnd,SW_HIDE) works)
But the keystroke events in wndproc are not logged.. And the value in the OldWndProc is always 0x0000000.
-
November 21st, 2010, 01:49 AM
#4
Re: Changing Window Procedure
Have you looked into SetWindowsHookEx? If a keyboard hook is what you want, then why not set it up the usual way?
-
November 21st, 2010, 12:17 PM
#5
Re: Changing Window Procedure
 Originally Posted by vinayak4gargya
From the debugger it is evident that i get the foreground window... (a call to showwindow(hwnd,SW_HIDE) works)...
But the keystroke events in wndproc are not logged.. And the value in the OldWndProc is always 0x0000000.
I presume the said code is executed in some process other than the foreground window belongs to. Well, to do that correct, the new window procedure must reside in the window's process. Otherwise the quoted code makes no sense.
well basically i want to log all keystroke events...
Well basically they do that some other way...
Best regards,
Igor
-
November 21st, 2010, 01:00 PM
#6
Re: Changing Window Procedure
oooh thanks a lot! So i need to hook into a process first?? Could somebody please elaborate on 'hooking'.. Or link to an article probably?
-
November 21st, 2010, 04:44 PM
#7
Re: Changing Window Procedure
Victor Nijegorodov
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
|