Click to See Complete Forum and Search --> : KeyBoard HOOK
priyank9
November 24th, 2006, 07:03 AM
Hi, I am using WH_KEYBOARD_LL global hook to detect keystrokes in any window. Is there any way to get handle of a window that is related to key stroke or handle of the window in which I am writing? Thanks in advance.
golanshahar
November 24th, 2006, 07:07 AM
The window in which you writing into should be in focus, so ::GetForegroundWindow() should help you in that case.
Cheers
priyank9
November 24th, 2006, 08:44 AM
Thanks for your reply, But this one give me handle of the main form not a specific edit control in that form.
golanshahar
November 24th, 2006, 10:12 AM
Thanks for your reply, But this one give me handle of the main form not a specific edit control in that form.
Also take a look at: ::GetGUIThreadInfo() (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/getguithreadinfo.asp) in the GUITHREADINFO struct there is the hwndCaret which is the inner hwnd that holds the caret in which you are typing to also hwndFocus can be enough for you.
Cheers
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.