09-30-2021 08:21 AM
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.
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.
Solved! Go to Solution.
09-30-2021 08:36 AM
@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.
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.
09-30-2021 08:49 AM
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...
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.
09-30-2021 10:37 AM
@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.
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.
09-30-2021 03:44 PM
You could use .NET instead of LabVIEW property nodes to get the information.
Post I made about it a while ago
09-30-2021 04:03 PM - edited 09-30-2021 04:06 PM
@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!
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.
10-13-2021 09:33 AM
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.
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.