Solved

Which  window handle is returned on Windows 7 using  findWindow("Progman", "Program Manager")

Posted on 2010-09-01
7
2,262 Views
Last Modified: 2013-12-14
First,  I am surprised that this call works since Windows 7 doesn't use Program Manager.

Will this call return the correct virtual screen size in a multiple monitor setup on Windows 7?
0
Comment
Question by:pink1964
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 9

Assisted Solution

by:JohnGaby
JohnGaby earned 100 total points
ID: 33591264
Are you trying to get the size of the various monitors attached to the system?  If so the following link might be useful:

http://msdn.microsoft.com/en-us/library/dd145072%28v=VS.85%29.aspx

If you are just looking for the handle to the desktop, try:

http://msdn.microsoft.com/en-us/library/ms633504%28VS.85%29.aspx
0
 
LVL 50

Expert Comment

by:jcimarron
ID: 33593412
pink1964--I confess to not understanding the question.  None of the commands listed work in Win7. Progman.exe does not come with Win7.
So following on JohnGaby's post, what is it you want to do?
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 400 total points
ID: 33594155
Hmm.

    HWND hWnd = ::FindWindow(_T("progman"), _T("Program Manager"));
    RECT rc;
    ::GetWindowRect(hWnd, &rc);


rc does contain the total size of a dual monitor system (on windows 7) BUT I don't know if I would trust it to do that reliably.
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Closing Comment

by:pink1964
ID: 33598172
Thanks Andy for confirming my test results.  

I posed my original question because I was hoping some of you might know if there was a legitimate reason Microsoft left this code in Windows 7;  it appears based on the responses I've gotten that this is not the case.  
I agree that using a reference to the Program Manager  is probably not reliable on Windows 7 and think it is likely an artifact that was overlooked and could go away at any time.

That said, there are many examples on the web which use the call to findWindow("Progman", "Program Manager");  a colleague of mine found one and used it to find the virtual screen size.  The call works fine on XP, but we need to support Windows 7 as well.
John Gaby posted a useful link.  

I tested GetDesktopWindow and it works fine for the primary monitor.  On a two monitor setup using XP,  the rectangle it returned was the one for the primary monitor only.  I have not tested a two monitor setup using this call on Windows 7.

I am currently using GetSystemMetrics, calling it 4 times to retrieve the virtual screen coordinates: SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN, SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN.  

Thanks again for your assistance!
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 33598613
JUST A GUESS:
It could be Microsoft left it in to stop apps breaking on Win 7.  (Feedback from beta testing for example)
0
 

Author Comment

by:pink1964
ID: 33613113
Very good and plausible guess Andy.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Change to event 1 135
eclipse package explorer vs project explorer view 2 267
Where are the c++ header files to use in Eclipse? 4 73
Input parameteres to DragOver 2 58
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question