[MFC] how to get screen width, height

GetWindowRect(), GetDesktopWindow()

CRect rc;
::GetWindowRect(GetDesktopWindow()->m_hWnd, &rc);
int nWidth = rc.right - rc.left;
int nHeight = rc.bottom - rc.top;

GetSystemMetrics()

int nWidth = GetSystemMetrics(SM_CXSCREEN);
int nHeight = GetSystemMetrics(SM_CYSCREEN);

GetDeviceCaps()

HDC hDC = GetDC();
int nWidth = GetDeviceCaps(hDC, HORZRES);
int nHeight = GetDeviceCaps(hDC, VERTRES);
H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now