473,624 Members | 2,458 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 4197
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.megan ewsservers.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
2860
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 scans, index scans are very limited in size) ). Write performance is generally more important than read performance, read performance of heavy queries (the ones with table scans) is not important at all. Question: how to spread data across...
11
2015
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 the image but in design time mode all variables concerning Server or Context ar not set ! ...so I can't use MapPath function to obtain the physical parth of the picture ... So my second question is how to retrieve the physical root path of the...
12
3675
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. -- -- TOC entry 59 (OID 11462032) -- Name: order_to_do; Type: TABLE; Schema: public; Owner: www -- Data Pos: 0 --
6
4332
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 circle looked about 10% taller than they should be. Naturally, correcting the screen resolution to the monitor's native of 1280x1024 fixed this and displayed more accurate proportions. Because this change made all screen elements microscopic,...
7
20701
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 printer's physical margins using VB coding? Cheers -- Osmotion Blue
10
1795
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 bottom of almost every form. I haven't figured out yet if there's a pattern to it. I compared two forms -- one that looks okay and one that gets cropped, and aside from the size and the accept button and the cancel button, their properties are...
2
2108
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 = $_POST;
3
3455
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 ever done something like this before? I would rather do this instead of trying to open the file exclusively.
2
2645
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 it breaks down to this series of events. 1. Determine the users monitor size. 2. Determine the users screen resolution size. 3. Calculate the height and with to scale the image to for a constant size. 4. Display the image.
0
8240
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8175
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8680
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7168
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2610
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 we have to send another system
1
1791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1487
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.