- 获取整个桌面的大小
1 int cx = GetSystemMetrics(SM_CXFULLSCREEN); 2 int cy = GetSystemMetrics(SM_CYFULLSCREEN);
- 获取有效区域的桌面大小(一般情况就是出去任务栏之后的桌面大小)
RECT rect; SystemParametersInfo(SPI_GETWORKAREA, 0, &rect, 0); int cx = rect.right - rect.left; int cy = rect.bottom - rect.top;