CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    GetDesktopWindow()

    Code:
    	RECT desktop_rect;
    
    	GetWindowRect(GetDesktopWindow(), &desktop_rect);
    My PC has two monitors - each of which is 1600x1200. Therefore I expected the above code to return a rectangle of 3200x1200 for my desktop window. However, it only returned 1600x1200. What have I done wrong...
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: GetDesktopWindow()

    This is by design with compatibility with older applications. It always returns the rectangle of the primary monitor. You need to call EnumDisplayMonitors() to get information about each monitor.

    Have a look here: http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: GetDesktopWindow()

    This Virtual Screen Coordinates essay can also help...
    Victor Nijegorodov

  4. #4
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Re: GetDesktopWindow()

    Thanks. I was able to fix it after reading those articles
    "A problem well stated is a problem half solved.” - Charles F. Kettering

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured