0

I apologize if this is a very basic question, but I'm just starting to learn about pixels, resolution, DPI-awareness, etc.

I'm creating a File Explorer extension that positions windows and text over specific Explorer UI elements. It's implemented as a browser helper object, so my code is called from within Explorer's process space.

In order to position windows and elements for my extension, I'll typically get a bounding RECT from a specific IUIAutomationElement within Explorer's UI, then perhaps move or deflate that RECT slightly, and then use the RECT to position a text control over Explorer. I haven't been able to find any system metrics that correspond to the correct positions for my elements, so I determine the correct placement after trial and error with specific numeric values, like 1, 2, or 5, etc.

Here's my question: Let's say I find the correct position values on my computer. What I'm unclear on is whether those values will be correct on other machines (and other versions of Windows). I don't quite understand if the coordinates or pixels may be off depending on other users' resolution. Is it relevant that my code is being called by Explorer?

So for example, let's say the appropriate placement for an element (on my machine) is the vertical scrollbar's bounding rectangle, but deflated by 2. Will that translate appropriately to others' machines?

Thank you very much for any guidance.

  • Unfortunately none of that stuff has ever been documented. – Jonathan Potter May 19 '20 at 02:57
  • Even if the values themselves aren't documented, can we expect the values to translate properly across devices? –  May 19 '20 at 03:11
  • Who knows? It's not documented so there's no guarantee. In particular, some might be scaled by the system DPI and some might be fixed. Some might change depending on the phase of the moon. (Ok probably not). Odds are it'll be consistent but you never know. – Jonathan Potter May 19 '20 at 04:31
  • @loop123123 Most likely not. Some easy things to try is change the monitor DPI to extreme values, change themes and/or change the theme parameters to non-default values. – dxiv May 19 '20 at 04:35
  • They aren't even consistent on *your* machine at different times. Try this: Run Explorer and gather the values. Open the *Settings* app, switch to *Ease of Access* and change the setting *Make text bigger*. Go back to Explorer and see if you get the same values back. – IInspectable May 19 '20 at 08:57
  • Well so far after messing with monitor resolution, Ease of Access, themes, etc., the values seem to be correct. Now I just have to try out a different moon phase :-) –  May 19 '20 at 13:31

0 Answers0