Are you wanting the size of the window's client area?
Use the GetClientRect() API function.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633503%28v=vs.85%29.aspx
The size of a window is more than just the client area + the caption area/title bar. There is the size of:
1. if present the menu bar
2. the size/thickness of the window frame, x 2. (top and bottom, left and right). This can vary depending of the window is sizable or static sized.
3. if present the size of the scroll bar, horizontal and vertical
4. if present the size/thickness of a 3D border.
5. if present the size of toolbars, dockable or static.
6. if present the size of a status bar.
There might be other non-client parts of a window I forgot, the 6 I mentioned are the most common that change the size of the client area.
To find out the usable area of the desktop window you use the GetSystemMetrics() API function with SM_CXFULLSCREEN and SM_CYFULLSCREEN. SM_CYFULLSCREEN would return the height of the desktop without the height of the taskbar, if the taskbar is at the bottom or top of the desktop. Some people move their taskbar to the left or right of the screen.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724385%28v=vs.85%29.aspx
To obtain the size of the desktop (the work area), without just the taskbar, you can use GetSystemMetrics() API function.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724385%28v=vs.85%29.aspx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
#include <windows.h>
int main()
{
// size of screen (primary monitor) without taskbar or desktop toolbars
std::cout << GetSystemMetrics(SM_CXFULLSCREEN) << " x " << GetSystemMetrics(SM_CYFULLSCREEN) << "\n";
// size of screen (primary monitor) without just the taskbar
RECT xy;
BOOL fResult = SystemParametersInfo(SPI_GETWORKAREA, 0, &xy, 0);
std::cout << xy.right - xy.left << " x " << xy.bottom - xy.top << "\n";
// the full width and height of the screen (primary monitor)
std::cout << GetDeviceCaps(GetDC(NULL), HORZRES) << " x " << GetDeviceCaps(GetDC(NULL), VERTRES) << "\n";
}