[MFC] how to get screen width, height

in #programming7 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.17
TRX 0.24
JST 0.034
BTC 95924.26
ETH 2810.51
SBD 0.67