DPI Settings

J

jasonhrowan

I know how to change the dpi settings on windows xp, but does anyone
know how to do it via the registry or vb etc. I need to do this
becasue i have to create a sms wrap to change the dpi settings on a
lot of laptops.

Cheers

Jason Hough.
 
N

Newbie Coder

Jason,

To detect the DPI in VB.NET:

Dim dpi As Graphics = Me.CreateGraphics
MessageBox.Show(String.Format("X={0}, Y={1}", dpi.DpiX, dpi.DpiY),
"DPI Settings", MessageBoxButtons.OK, MessageBoxIcon.Information)

Here's a old VB6 way of changing the DPI settings & can easily be changed to
VB.NET:
You won't need much of this code because the ExitWindowsEx function will
fail on NT/2000/XP machine because it isn't setting the shutdow privilege

http://allapi.mentalis.org/apilist/GetDeviceCaps.shtml#

There are two registry keys I know of that handle the DPI settings & they
are:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
NT\CurrentVersion\FontDPI\LogPixels
HKEY_CURRENT_USER\Control Panel\Desktop\WindowsMetrics\AppliedDPI

I hope this helps,
 
J

jasonhrowan

Jason,

To detect the DPI in VB.NET:

Dim dpi As Graphics = Me.CreateGraphics
MessageBox.Show(String.Format("X={0}, Y={1}", dpi.DpiX, dpi.DpiY),
"DPI Settings", MessageBoxButtons.OK, MessageBoxIcon.Information)

Here's a old VB6 way of changing the DPI settings & can easily be changed to
VB.NET:
You won't need much of this code because the ExitWindowsEx function will
fail on NT/2000/XP machine because it isn't setting the shutdow privilege

http://allapi.mentalis.org/apilist/GetDeviceCaps.shtml#

There are two registry keys I know of that handle the DPI settings & they
are:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows
NT\CurrentVersion\FontDPI\LogPixels
HKEY_CURRENT_USER\Control Panel\Desktop\WindowsMetrics\AppliedDPI

I hope this helps,

--
Newbie Coder
(It's just a name)


Thankyou very much newbie.
Err which reg key should i investigate to change the dpi setting from
90 ?
I may as well use the registry keys over vb6.

Many thanks

Jason
 
N

Newbie Coder

Jason,

The VB 6 code has been converted to VB.NET 7.1 by me & I am just working on
the screen resolution when I get the chance, but I have other work to be
getting on with at the moment - sorry

It is the actual screen resolution you require rather than the DPI I think.
Am I right?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top