473,396 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

system DPI settings

Is there a way to obtain the system DPI settings? (i.e.,
the value that is set under Display Properties - Settings
Tab - Advanced... - General Tab - Font Size.)

Thanks,
Lance
Nov 20 '05 #1
3 1327
* "Lance" <zi***@hotmail.com> scripsit:
Is there a way to obtain the system DPI settings? (i.e.,
the value that is set under Display Properties - Settings
Tab - Advanced... - General Tab - Font Size.)


Untested, quick and dirty:

\\\
Private Declare Auto Function GetDesktopWindow Lib "user32.dll" ( _
) As IntPtr

Private Declare Auto Function GetDC Lib "user32.dll" ( _
ByVal hWnd As IntPtr _
) As IntPtr

Private Declare Auto Function GetDeviceCaps Lib "gdi32.dll" ( _
ByVal hdc As IntPtr, _
ByVal nIndex As Int32 _
) As Int32

Private Declare Auto Function ReleaseDC Lib "user32.dll" ( _
ByVal hWnd As IntPtr, _
ByVal hdc As IntPtr _
) As Int32

Private Function SmallFonts() As Boolean
Dim hWndDesktop As IntPtr, hDCDesktop As IntPtr
Dim PixelsX As Int32
hWndDesktop = GetDesktopWindow
hDCDesktop = GetDC(hWndDesktop)
PixelsX = GetDeviceCaps(hDCDesktop, 88)
ReleaseDC(hWndDesktop, hDCDesktop)
SmallFonts = (PixelsX = 96)
End Function
///

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
You might want to check Graphics.DpiX / DpiY. You can obtain Graphics
instance using Graphics.FromHwnd and other methods.

HTH
Alex

"Lance" <zi***@hotmail.com> wrote in message
news:01****************************@phx.gbl...
Is there a way to obtain the system DPI settings? (i.e.,
the value that is set under Display Properties - Settings
Tab - Advanced... - General Tab - Font Size.)

Thanks,
Lance

Nov 20 '05 #3
Thanks to both replies!
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: RBisch | last post by:
I am finding that some of the properties off of the PrinterSettings object are misleading For example, When I test the CanDuplex on a printer I know duplexes, the property is false. Another one...
2
by: Phil Stanton | last post by:
When designing a new form or report, the Default ForeColor is often something like -2147483640 which is the colour of Windows text (possibly black) and the default backColor is -2147483643...
1
by: Billy Hart | last post by:
I am getting this error on my win 2000 server when a .net app that a programmer in my office developed. I have read other posts about the issue but the resolutions to those posts did not solve the...
3
by: Juhan | last post by:
Hi! I have a strange error in a console application that is hosted by IIS 5.0 and invokes a web service hosted on the same machine. A request form the web comes in and it is dispatched to a...
2
by: Jeff | last post by:
Hey asp.net 2.0 My asp.net 2.0 project has got a assembly load problem: Some of my web.config settings: <membership defaultProvider="AH_MembershipProvider" userIsOnlineTimeWindow="15">
4
by: adi | last post by:
Hi I'm using .NET Framework 1.1 My application needs to read the system's language settings. How to do this? Thanks.
4
by: rsdev | last post by:
Hi, I have an InvalidCastException which is completely puzzling me. I have checked all the members in the stored procedure against my data provider and seems to be ok. Also in the stack trace it...
1
by: Pedro Dinis | last post by:
i have this class library that connects to the database(see appconfig below) compiling 0 errors but when its running i amhaving this error An unhandled exception of type...
3
brclancy111
by: brclancy111 | last post by:
Hello. I've been programming for 1 year now, and never saw this coming... When I try to use File.Exists("Data/Settings.dat") it does absolutely nothing. I am trying to build a system that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.