Get Screen area

I don't know the function to get the screen size.
Please tell me.
[74 byte] By [developer-network] at [2007-11-16 5:42:04]
# 1 Re: Get Screen area
Look at GetDeviceCaps with HORZSIZE/VERTSIZE and HORZRES/VERTRES
at 2007-11-10 4:42:14 >
# 2 Re: Get Screen area
CRect rect;
GetClientTect (&rect);
// rect now has rect.top, rect.bottom, rect.right and rect.left window size.
herbieII at 2007-11-10 4:43:15 >
# 3 Re: Get Screen area
Sorry.I want to know the (API) function to get the System Screen Size.
For exaple 800 X 600, 640 X 480.
at 2007-11-10 4:44:14 >
# 4 Re: Get Screen area
HDC hdc = ::GetDC(NULL);
int x = GetDeviceCaps(hdc, HORZRES); returns 600 (800)
int y = GetDeviceCaps(hdc, VERTRES); returns 480 (600)
::ReleaseDC(NULL, hdc);
at 2007-11-10 4:45:19 >
# 5 Re: Get Screen area
You can also try CWnd::GetDesktopWindow()->GetWindowRect(&rect), if you are using MFC. Or ::GetWindowRect(::GetDesktopWindow(), &rect)
at 2007-11-10 4:46:19 >
# 6 Re: Get Screen area
The following code will get the width and height, in pixels, of the screen of the primary display monitor:

int nScreenWidth = ::GetSystemMetrics(SM_CXSCREEN)
int nScreenHeight = ::GetSystemMetrics(SM_CYSCREEN)
at 2007-11-10 4:47:18 >