Calculate window size in Vista
Usually, we use GetWindowRect to calculate windows size in windows. It works always right until vista comes.
Under Vista, if you still use GetWindowRect to retrieve windows rectangle size, you can not always get the collect value.
For some windows which can not be resized, the function return bigger size than it is.
The problem is caused of the new Desktop Window Management features, exactly, extending frame.aspx “Custom Window Frame Using DWM”).
To resolve the problem, you can use DWM api,
DwmGetWindowAttribute, instead of the GetWindowRect before Microsoft fixed it.
The api I can be used like following,