Hello,
Best way may be to get the screen DC and use GetDeviceCaps to find the pixels (VERTRES, HORZRES) and pixels per inch (LOGPIXELSX, LOGPIXELSY) of X and Y direction. From these data, it is easy to calculate the aspect ratio.
Better still, GetDeviceCaps, when called with parameter HORZSIZE / VERTSIZE returns the entire width / height of physical screen.
Regards,Code:HDC hDC = ::GetDC(NULL); int nWidth = GetDeviceCaps(hDC, HORZSIZE); int nHeight = GetDeviceCaps(hDC, VERTSIZE); CString sRatio; sRatio.Format("Width to Height ratio is %d:%d", nWidth, nHeight); pDC->TextOut(0, 0, sRatio); ::ReleaseDC(NULL, hDC);
Pravin.




Reply With Quote