Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3725146
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T06:54:00+00:00 2026-05-19T06:54:00+00:00

In Windows XP and above, given a window handle (HWND), how can I tell

  • 0

In Windows XP and above, given a window handle (HWND), how can I tell if the window position and size leaves the window irretrievably off screen? For example, if the title bar is available to the cursor, then the window can be dragged back on screen. I need to discover if the window is in fact visible or at least available to the user. I guess I also need to know how to detect and respond to resolution changes and how to deal with multiple monitors. This seems like a fairly big deal. I’m using C++ and the regular SDK, so please limit your answers to that platform rather than invoking C# or similar.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T06:54:02+00:00Added an answer on May 19, 2026 at 6:54 am

    Windows makes it relatively simple to determine the size of a user’s working area on the primary monitor (i.e., the area of the screen not obscured by the taskbar). Call the SystemParametersInfo function and specify the SPI_GETWORKAREA flag for the first parameter (uiAction). The pvParam parameter should point to a RECT structure that will receive the coordinates of the working area in virtual screen coordinates.

    Once you’ve got the coordinates that describe the working area, it’s a simple matter of comparing those to the current position of your application’s window to determine if it lies within those bounds.

    The desire to support multiple monitors makes things slightly more complicated. The documentation for SystemParametersInfo suggests that you need to call the GetMonitorInfo function instead to get the working area of a monitor other than the primary. It fills in a structure called MONITORINFOEX that contains the member rcWork that defines the working area of that monitor, again expressed in virtual screen coordinates as a RECT structure.

    To do this right, you’ll need to enumerate all of the monitors a user has connected to the system and retrieve the working area of each using GetMonitorInfo.

    There are a few samples of this to be found around the Internet:

    • MSDN has some sample code for Positioning Objects on a Multiple Display Setup.
    • If you’re using MFC, here’s what looks to be an excellent example of multiple monitor support.
    • Even if you’re not using MFC, that article refers the following link which looks be a real gem as far as explaining how multiple monitor supports works in Windows, even if it’s a little bit old school. Like it or not, very little of this has changed in later versions of Windows.

    Finally, you mentioned wanting to detect resolution changes. This is much simpler than you probably imagined. As you know if you’ve done any Windows programming, the primary way that the operating system communicates with your application is by sending messages to your WindowProc function.
    In this case, you’ll want to watch for the WM_DISPLAYCHANGE message, which is sent to all windows when the display resolution has changed. The wParam contains the new image depth in bits per pixel; the low-order word of the lParam specifies the horizontal resolution and the high-order word of the lParam specifies the vertical resolution of the screen.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to deveplop an app for Windows Mobile 5.0 and above that can
scrollPosition = window.frames[id].document.body.scrollTop; The above code doesn't work correctly. Please tell me how to
Suppose multiple Modal Windows shown above each other. All of those have ShowInTaskbar =
I'm developing an winform application for Windows Mobile 5.0 and above. I'm using .Net
From the Question above, I've made a simple windows app similar to MSN and
b.driver.manage.window.resize_to(1000, 1000) That line above doesn't work with chrome on my mac. I am
http://i44.tinypic.com/b69h1h.jpg Take a look at the above image, especially the Firebug window. Now have
windows.h is included, code: #include <windows.h> int main() { HANDLE hToken; DWORD dwSize; TOKEN_ELEVATION_TYPE
I (Windows 7 user) would appreciate if someone can give a simple explanation or
Given a Windows Server 2008 R2 system, where the service accounts use a non-English

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.