[MFC] how to get screen width, height

in #programming6 years ago (edited)

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);
Sort:  

@pepsiman, I gave you an upvote on your first post! Please give me a follow and I will give you a follow in return!

Please also take a moment to read this post regarding bad behavior on Steemit.

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.030
BTC 62704.97
ETH 2442.73
USDT 1.00
SBD 2.66