Both return 0. Is there another way to get both the X & Y PixelsPerInch?
Or should I use Screen->PixelsPerInch and assume square pixels?
TIA
B
According to MSDN:
"Any function that returns a display device context (DC) normally
returns a DC for the primary monitor. To obtain the DC for another monitor,
use the EnumDisplayMonitors function. Or, you can use the device name from
the GetMonitorInfo function to create a DC with CreateDC."
Gambit
"Bill" <Bi...@bill.net> wrote in message news:3D5BF12B...@bill.net...
> GetDeviceCaps() expects an HDC, but you're passing it an HMONITOR instead.
Ah....
> You need to manually obtain the proper HDC for a particular monitor first
>
> According to MSDN:
>
> "Any function that returns a display device context (DC) normally
> returns a DC for the primary monitor. To obtain the DC for another monitor,
> use the EnumDisplayMonitors function. Or, you can use the device name from
> the GetMonitorInfo function to create a DC with CreateDC."
The Win32 SDK help doesn't have any information on GetMonitorInfo or
EnumDisplayMonitors. Is there another place I can find information on these?
B
Never mind... Did a google search and found a posting with the appropriate
information.
Thanks...
B
Gambit
"Bill" <Bi...@bill.net> wrote in message news:3D5C0525...@bill.net...
http://home.iprimus.com.au/starcinema2001/GetMonitorInfo.html
That I hope it helps
Rodolfo
"Bill" <Bi...@bill.net> wrote in message news:3D5BF12B...@bill.net...
void Get_MonitorInfo()
{
String S_xscreen;
String S_yscreen;
String S_screenwidth_mm;
String S_screenheight_mm;
String S_bitsperpixel;
String S_ppi_x;
String S_ppi_y;
HWND hDesktop = GetDesktopWindow();
HDC hdc = GetDC( hDesktop );
S_xscreen = String( GetSystemMetrics( SM_CXSCREEN ) );
S_yscreen = String( GetSystemMetrics( SM_CYSCREEN ) );
S_bitsperpixel = String( GetDeviceCaps(hdc,BITSPIXEL) );
S_screenwidth_mm = String( GetDeviceCaps( hdc, HORZSIZE ) );
S_screenheight_mm = String( GetDeviceCaps( hdc, VERTSIZE ) );
S_ppi_x = String( GetDeviceCaps( hdc, LOGPIXELSX ) );
S_ppi_y = String( GetDeviceCaps( hdc, LOGPIXELSY ) );
ShowMessage( "Screen Resolution (pixels) "
+ S_xscreen + "x"
+ S_yscreen + "\n"
+ "Screen Width " + S_screenwidth_mm + " mm" + "\n"
+ "Screen Height " + S_screenheight_mm + " mm" + "\n"
+ "Bits per pixel " + S_bitsperpixel + "\n"
+ "Pixels per inch (x) " + S_ppi_x + "\n"
+ "Pixels per inch (y) " + S_ppi_y );
}
Rodolfo