LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the characters size (DPI) set on your screen

Hello,

I'd need to know which type of characters is currently set on my video (Normal 96dpi or Large 120dpi).
Is there anybody who can suggest me the way?

Thanks
Sergio
0 Kudos
Message 1 of 5
(4,024 Views)

In XP, right click on the Desktop, choose Properties, then the Settings tab, then "Advanced" button, then the "General" tab.   (You can get there from the display settings in the Windows Control Panel too.)

Note that this DPI setting is NOT specific to characters - it is the whole screen. There is also a separate "Font Size" option on the "Appearance" tab of the Display Properties dialog box that has "Large" and "Normal".  In general I have found the DPI setting to be more problematic; try keeping it at 96dpi if at all possible.

--Ian

0 Kudos
Message 2 of 5
(4,001 Views)
Thank you Ian,

but sorry, probably I didn't explain my question clearly.
I do know how to set or read video dpi manually.
What I don't know is how to get the information inside my CVI code.
The problem is that I have to deploy my program on many PCs and I have prepared two set of panels, one suited for 96dpi and the other for 120dpi. So I'd need to know the dpi setting on the PC where my program starts, in order to load the appropriate set of panels (of course both the solutions have the same controls and tab order).
Any ideas? Thanks again.

Sergio
0 Kudos
Message 3 of 5
(3,984 Views)

The following code using the GDI functions returns the number of pixels per logical inch:

 HWND hWnd;
 HDC hDC=0;     

 int iLogPixX, iLogPixY;
 
 GetPanelAttribute (hPanel, ATTR_SYSTEM_WINDOW_HANDLE, (int *)&hWnd);
 hDC = GetDC( hWnd);
 
 
 iLogPixX= GetDeviceCaps(hDC, LOGPIXELSX);
 iLogPixY= GetDeviceCaps(hDC, LOGPIXELSY);

 

Message 4 of 5
(3,980 Views)

This  may help:

Try to get the system screen resolution: GetScreenSize (&horizontalrez,&verticalrez ); (from this you can calculate the actul sizes you need in points

Gent the font info:

 the GetFontTypefaceName ("", );

and finally GetTextDisplaySize ("", "", , );

Find al of this in the Miscellaneous section of User Interface Library.

layosh

0 Kudos
Message 5 of 5
(3,937 Views)