Skip to main content
GameDev.net gamedev.net
🔒 Locked

gettin window information. help.

Started by simbiant Apr 15, 2004 at 10:18 AM 3 replies 200+ views
Original Post
simbiant
simbiant
is there any windows API command that returns the hWnd of whatever the user has focus to? and i mean universally, across all the windows on the screen. meaning, if i have my cursor in a textbox on some random window, it would return the textbox hwnd. or if a button on another window had focus set to it, it would tell you that hwnd. is there such an api command?
simbiant
simbiant
by the way i know of the function GetActiveWindow, but that only returns the parent window which has focus... i want the actual control within the window..

is it possible?
simbiant
simbiant
HELP.
Promit
Promit
Maybe the GetFocus() function will do what you need, but I haven''t tried it.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Colin Jeanne
Colin Jeanne
GetFocus() only works for the current thread but the MSDN explains that you could use AttachThreadInput() on the forground thread to allow GetFocus() to work across threads.

Or, if you are using Win98 or Win NT SP3 or later, you could use GetGUIThreadInfo() with the first parameter as 0. The GUITHREADINFO structure has the HWNDs for windows in various GUI states.


Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.