LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bug With Disp.AllMonitors VI Server property

Solved!
Go to solution

I've been using this VI to read monitor resolutions, and I've just now come across a pretty bad bug with it. Least I'm pretty sure it's a bug.

 

If the following Windows setting is at 100%, the VI behaves normally, giving the expected 1920x1080 resolution.

 

At 125%, I get 1536x864.

At 150%, I get 1280x720.

And at 175%, I get 1097x617.

 

The resolution of the monitor itself isn't changing though? I felt confused so I took a screenshot and the ss is 1920x1080 no matter what, so what gives?

 

Main reason for my posting is to ask for another way to get the proper screen resolution regardless of this setting. But is there an active CAR for this?

 

I did make a separate VI to get that Windows setting, in case I need to go the route of using the same method to get res but account for that setting. However, the setting is on a per-monitor basis so on a multi-monitor setup that would immensely complicate things I feel like. Also that VI involves reading registry keys so not sure about possible permissions conflicts.

 

As always, any and all feedback is appreciated.

 

Spoiler
FireFistRedhawk_0-1633007486920.png
Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 1 of 7
(1,594 Views)

@FireFist-Redhawk wrote:

I've been using this VI to read monitor resolutions, and I've just now come across a pretty bad bug with it. Least I'm pretty sure it's a bug.

 

If the following Windows setting is at 100%, the VI behaves normally, giving the expected 1920x1080 resolution.

 

At 125%, I get 1536x864.

At 150%, I get 1280x720.

And at 175%, I get 1097x617.

 

The resolution of the monitor itself isn't changing though? I felt confused so I took a screenshot and the ss is 1920x1080 no matter what, so what gives?

 

Main reason for my posting is to ask for another way to get the proper screen resolution regardless of this setting. But is there an active CAR for this?

 

I did make a separate VI to get that Windows setting, in case I need to go the route of using the same method to get res but account for that setting. However, the setting is on a per-monitor basis so on a multi-monitor setup that would immensely complicate things I feel like. Also that VI involves reading registry keys so not sure about possible permissions conflicts.

 

As always, any and all feedback is appreciated.

 

Spoiler
FireFistRedhawk_0-1633007486920.png

I know this is a workaround and not a fix, but if you multiply the returned size by the scaling factor, you get the correct resolution.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 7
(1,585 Views)

I didn't break out the calculator to check but I figured that was the case. I'd like that to be a last resort for the reasons I mentioned near the end. Gonna attach my VI that reads that setting though. Couple things with it...

 

  • It reads the setting for each monitor connected, and outputs it as key-value pairs where 0 corresponds to 100%, 1 to 125% and so on. Would need a full list of those key-value pairs from somewhere.
  • It reads them by some kind of identifier of the monitor. Would need some way to pair each of these percentages with the right monitor from the property node output (not sure if in the registry they are listed alphabetically or in the order of how they are arranged left to right, or by order of which got connected first).
  • Again, it reads registry keys so not sure about permissions issues. This is actually the first thing I've ever made that interacts with the registry.
Spoiler
Get Windows Scale.png

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 3 of 7
(1,580 Views)

@FireFist-Redhawk wrote:

I didn't break out the calculator to check but I figured that was the case. I'd like that to be a last resort for the reasons I mentioned near the end. Gonna attach my VI that reads that setting though. Couple things with it...

 

  • It reads the setting for each monitor connected, and outputs it as key-value pairs where 0 corresponds to 100%, 1 to 125% and so on. Would need a full list of those key-value pairs from somewhere.
  • It reads them by some kind of identifier of the monitor. Would need some way to pair each of these percentages with the right monitor from the property node output (not sure if in the registry they are listed alphabetically or in the order of how they are arranged left to right, or by order of which got connected first).
  • Again, it reads registry keys so not sure about permissions issues. This is actually the first thing I've ever made that interacts with the registry.
Spoiler
Get Windows Scale.png


I think reading is fine.  It's writing that might give you issues.  And yes, that's why I didn't offer my observation as a solution.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 7
(1,559 Views)
Solution
Accepted by topic author FireFist-Redhawk

You could use .NET instead of LabVIEW property nodes to get the information.

 

Post I made about it a while ago

 

Link to the Microsoft docs page on the AllScreens property

Message 5 of 7
(1,548 Views)

@Kyle97330 wrote:

You could use .NET instead of LabVIEW property nodes to get the information.

 

Post I made about it a while ago

 

Link to the Microsoft docs page on the AllScreens property


Took the tiniest bit of fiddling to get the actual resolution instead of the working area, and it looks like this is going to work perfectly! I spent quite a while digging through .NET assemblies/properties looking for exactly that. Sucks that there's no way to search or sort or filter them or anything.

 

Thanks a bunch man!

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 6 of 7
(1,543 Views)

Update: as cool as the AllScreens property is, it experiences the same weird behavior on a TV screen (LG C1). For now I'm just taking the pixel dimensions of a screenshot and assuming the same dimensions for the screen. Lame but functional.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 7 of 7
(1,451 Views)