可以在你的程序的任何地方:
int x = GetSystemMetrics(SM_CXSCREEN);
int y = GetSystemMetrics(SM_CYSCREEN);
CString ClrText;
ClrText.Format("水平分辨率:%d\n垂直分辨率:%d",x,y);
::MessageBox(NULL,ClrText,"输出的RGB值",MB_OK);
GetDeviceCaps
HORZSIZE Width, in millimeters, of the physical screen.
VERTSIZE Height, in millimeters, of the physical screen.
或是先獲得每一英寸所對應的pixel數.再將英寸轉為毫米.
LOGPIXELSX Number of pixels per logical inch along the screen width. In a system with multiple display monitors, this value is the same for all monitors.
LOGPIXELSY Number of pixels per logical inch along the screen height. In a system with multiple display monitors, this value is the same for all monitors.