Question

I have what seems to be a relatively simple question, at least I hope it is. I want to know if it is possible to find the dpi of a monitor in labVIEW. If it is possible how would I go about in doing this.

Was it helpful?

OTHER TIPS

I'm not sure about density or dpi, since that is based on the resolution AND the physical dimensions of the monitor, but it is easy to just get the resolution of the monitor.

In the Block Diagram:

  1. Right click to bring up the palette -> Application Control -> VI Server Reference

  2. Left click on the reference and change to This Application

  3. Right click to bring up the palette -> Application Control -> Property Node

  4. Connect the Application Node to the Property Node

  5. Left click on the Property Node -> Display -> Primary Workspace

  6. The output of this is the dimensions of the primary monitor minus the height of the Windows Toolbar at the bottom

enter image description here

LabView doesn't seem to support getting the dpi or physical dimensions directly, but you can get it indirectly from the command line. Alternately, you could write an external DLL that implements GetDisplayDpi.

On Windows, here is how to get the physical dimensions on the command line:

Use dumpedid.exe to get information about the monitor:

To get the physical monitor size in LabView you would build a vi with these function blocks :

  1. System Exec to run dumpedid.exe
  2. Match Pattern with string "Image Size.*"
  3. Scan From String with format string "Image Size : %f X %f"

Add an additional output parameter to Scan From String. The two outputs are the physical screen dimensions as reported by the hardware (in cm.)

enter image description here

You could get the resolution from this program with another Match Pattern/Scan, but it's easier to use the system property node!

Caution: the property for Display:Primary Workspace is less than the full display height, it has the Windows taskbar height subtracted. You will need to go through the Disp.AllMonitors property to get the correct values.

Here is a full block diagram that retrieves the main monitor resolution and computes dpi. You will have to round the values - they will be numbers like 94.07 or 142.7.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top