   Win XP correct destop area size
  I need to know what is the maximum size of a not maximized window in a current desktop setup (res and task bar size). Max size which allows restoring window, without maximizing it. I have caption and border size. I need to account for taskbar, also if it's wider that usual. How can I get this info? Win32, WinXP.[Edited by - Turold on August 16, 2008 1:11:16 PM]
SystemParametersInfo:RECT rcWork;SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWork, 0);// rcWork now contains the rect representing the working area (Fullscreen window area)EDIT: I'm not entirely sure if you want to also use AdjustWindowRectEx too, which will let you determine the size of a window frame.   ;  Yeah! Thx! Evil Steve ROCKS! :D   ;  Decisions, decisions...1. For a specific monitor in a multi-monitor system:a) MonitorFromRect() to get the handle of a monitor you're interested in.b) EnumDisplayMonitors() to get handles for all monitors.c) GetMonitorInfo() to get ino about that monitor.d) The rcWork member of the MONITORINFO takes the taskbar into account.Bear in mind that:- Each monitor might be at different resolution to the others. - If you're using the GPU there can be a significant performance penalty if your window straddles two monitors (Windows needs to copy pixels using the CPU in this case).- Monitors don't necessarily need to be in order, monitor 1 might be to the right of monitor 2.2. GetSystemMetrics() with SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN, SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN.3. SystemParametersInfo() with SPI_GETWORKAREA.4. GetSystemMetrics() with SM_CXMAXIMIZED, SM_CYMAXIMIZED.;  Now you are stretching it! :) It's funny, how seemingly simple things in theory, can get complicated in practice. My framework is for a casual game, so I'm 99.999% positive that my players will not have two monitors.I will add your Ultimate Solution to my "To Do" list. Thx!;Quote:Original post by TuroldNow you are stretching it! :) It's funny, how seemingly simple things in theory, can get complicated in practice. My framework is for a casual game, so I'm 99.999% positive that my players will not have two monitors.I will add your Ultimate Solution to my "To Do" list. Thx!I'm curious why you need to know the desktop area if your window isn't maximized? If you just use a maximized window, Windows will handle all this for you. Also, I wouldn't assume that not a lot of people have multiple monitors. It's likely that people won't, but you may be surprised how many people actually have multiple monitors.   ;  I need this, since I support automatic centering of window on work area in windowed mode.   