I’m trying to generate a bitmap containing what would be displayed if a window were to be restored to the desktop. GetWindowRect returns it’s minimized size, GetWindowplacement returns where it would go. But I can’t find a api that tells me how big it would be.
How do I determine how big the window would be if restored?
GetWindowPlacementis indeed what you want. Use thercNormalPositionwhich is aRECTcontaining the coordinates of the normalised position. Or, ifWPF_RESTORETOMAXIMIZEDis in the window placementflagsthen use the work area of the monitor with which the window is associated.Having said that,
GetWindowPlacementcan sometimes return misleading information inrcNormalPositionon Windows 7. I’ve come across this when you use the half screen Aero snap feature. After you do that, and if the window is still normalised when you ask the question, you will find thatGetWindowPlacementreturns inrcNormalPositionaRECTthat does not match the Aero snap position. Deal with that by simply usingGetWindowRectif the window is normalised.