473,500 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting PHYSICAL monitor size in C#

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
4 4182
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
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
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2839
by: Nobody | last post by:
DB2 500G database, Wintel, heavily loaded OLTP (5M+ transactions a day; all transactions are extremely small, all selects are controlled (no ad-hoc), 99% of all selects are very small (no table...
11
2005
by: KarimL | last post by:
Thanks for your advices... but i need to get the Image height because i dynamically resize the height of my webcontrol based on the image height. More i just have the url (relative parth) to the...
12
3653
by: Jared Carr | last post by:
First I wish I knew how this was caused but here is our problem. Sometime in the recent past we got a duplicate table. Here is the result of a pg_dump with a pg_restore for just that table. ...
6
4323
by: Yeah | last post by:
I just purchased a Samsung 930B flat-panel monitor. Its *recommended* resolution is 1280x1024. I was previously running at 1024x768, but I also work with graphics. Any images that were square or...
7
20665
by: Mark | last post by:
Hi, I am creating application in VB 2005. and when I print report it adds extra 0.45 cm margin on left and top, and the reason for this is physical margins of printer. Is it possible to change...
10
1783
by: RobinS | last post by:
Hello to all, and happy new year! I have this application that someone wrote that I'm sort of checking out. The forms look fine in design mode, but when I run the application, it crops off the...
2
2091
by: pm1ccc | last post by:
Hi, I have written following code and not getting back values in the same form ( i have used phpself) <?php $Fname = $_POST; $Lname = $_POST; $gender = $_POST; $food = $_POST; $quote =...
3
3448
by: nospam | last post by:
I am trying to monitor the process of a file being copied, but I cannot find a function that will return the actual file size, not the total file size, as reported by fileinfo.length. Has anyone...
2
2636
by: dpicella | last post by:
I have a semi-urgent need to solve a problem in Java. I have three small images that I need to hold to a constant size (e.g., 1 inch) regardless of both monitor size and resolution. Basically...
0
7136
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
7018
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
7232
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
5490
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.