By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,903 Members | 1,977 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,903 IT Pros & Developers. It's quick & easy.

Getting PHYSICAL monitor size in C#

P: n/a
Does anyone have an example of how to get the PHYSICAL monitor size in C#?

In C++ I used to use GetDeviceCaps( dc, HORZSIZE ) which returns the monitor
size in mm, then I
converted it to inches.

When I do this as unmanaged code in C#, I am getting back a value that show
my 19" monitor
has a width of only 12.9", whereas my trusty ruler shows it to be about
15.5".

Is this a driver problem, and if so, what am I to do?

Thanks in advance,
Chris Hough
Nov 15 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Valerie Hough wrote:
Is this a driver problem, and if so, what am I to do?


If it's a driver problem then your C++ program should have the same output.
as your C# program. Does it?

--
gabriel
Nov 15 '05 #2

P: n/a
My C++ program does produce the same output.

I should have said in my original post that the monitor is a 21" (not 19")
Hitachi CM801, video card is NVIDIA RIVA TNT 2 Model 64, resolution set to
800x600.
Nov 15 '05 #3

P: n/a
Valerie Hough wrote:
My C++ program does produce the same output.


I would be very doubtful you could rely on a function that returns a
monitor size, given that you don't know where windows is getting the
monitor size from. Windows has never asked me how big my monitor is...
There are monitor drivers, but how do you know you have the right one
installed (as you are finding out)?

--
gabriel
Nov 15 '05 #4

P: n/a

"gabriel" <no@no--spam.com> wrote in message
news:72**************************@msgid.meganewsse rvers.com...
Valerie Hough wrote:
My C++ program does produce the same output.


I would be very doubtful you could rely on a function that returns a
monitor size, given that you don't know where windows is getting the
monitor size from. Windows has never asked me how big my monitor is...
There are monitor drivers, but how do you know you have the right one
installed (as you are finding out)?


Exactly. The computer doesn't *know* the physical size of the monitor,
unless the driver *happens* to include that information. The computer
generates pixels, not inches, and without making any change in the computer,
you can plug in a different monitor and get the same picture, a different
size.
Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.