Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a specific handle

Status
Not open for further replies.

GeniuS26

Programmer
Jul 13, 2006
3
CA
Hello Everyone,

I have a small problem that I can't seem to figure out.
I am trying to get the "Program Manager's" hanlde.

I am currently retreiving the title from the handle and making sure its value is "Prgram Manager". My question is the following : is there a better way to retreive the Program Manager's handle without reading the title ? (Something like GetDesktopWindow() for the desktop's handle, or by reading its class?). If there isnt a better way, is this current method safe ?

My goal is to detect, when a hotkey is pressed, if there is a full screen apllication that is focused.

Im retreiving the handle with GetForegroundWindow.
Im retreiving its title to make sure I skip Program Manager.
Im retreiving its size with GetWindowLongA()
And I calculate its width and its height and compare it to the current resolution.

This method works great except for the fact that when the taskbar is set to autohide, the program manager window matches the width and height of the screen resolution. (with a difference of 8 pixels because windows seems to calculate differently on certain screens. If anyone has the answer to this I would like to know why !) That is why I must make sure i skip the program manager.

I also do not detect if its topmost window or not, like some people say I should, for the simple fact that most games are not topmost.

Spy++ give me handle 590018 decimal or 900c2 hex for the program manager.

If anyone has answers for my small questions it would be very appreciated.

Thank you
 
What about GetTopWindow() and GetWindowPlacement()?
I suppose, you are talking about handles of windows, not processes?
BTW, sorry about my ignorance, but what is Program Manager?
Is that Windows 3.11?
 

Hi mingis,

Program Manager is the title of the window that GetForegroundWindow returns when I have my desktop focused while no other apps is open. Its not a process im looking for. Its under Xp and 2k as well.

Basically when there is nothing open and just the desktop is focused and visible, its the handle returned by the GetForegroundWindow (or EnumWindow for that matter). Im not sure but I think its the Window that the desktop resides in ( which doesnt make sense since it doesnt match the handle from GetDesktopWindow() ). This is the reason why im asking the questions.

You can make a test if you wish with EnumWindow and print all the Window titles from the handles and you will see that Program manager is the only one that shows up when nothing else is open.

I wasnt able to find a better method.
I hope I was clear enough in my explanation.

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top