Detecting HiDPI Display on Windows

I currently use the following code (I think pulled from Xojo’s blog) for determining if a Window is running on a Retina (HiDPI) display:

Function ScalingFactor(win As Window) As Single #if TargetCocoa then declare function BackingScaleFactor lib "AppKit" selector "backingScaleFactor" (target as WindowPtr) _ as double return BackingScaleFactor(win) #else return 1 #endif End Function

If it returns > 1 it’s HiDPI. Obviously though this only returns 1 for both Windows & Linux. Does anyone know of a way (declare??) to determine if a Xojo Window is running on a HiDPI display on Windows (& Linux if possible)?

Thanks,

  1. This code is enclosed in a #If TargetCocoa: it will works only on OS X.

  2. No, I do not know. Did you check in Windows Functionality Suite ?

Here are the Windows declares for doing that:
http://www.xojo.com/blog/en/2013/11/writing-high-dpi-aware-windows-apps.php

There is also an article in xDev Magazine:
Issue 10.6 (September/October 2012):
Working With Retina: Making your Real Studio applications high resolution (Page 25)

link to ToC.

[quote=179772:@Christoph De Vocht]Here are the Windows declares for doing that:
http://www.xojo.com/blog/en/2013/11/writing-high-dpi-aware-windows-apps.php[/quote]
Perfect. Thank you.

[quote=179771:@Emile Schwarz]

  1. This code is enclosed in a #If TargetCocoa: it will works only on OS X.

  2. No, I do not know. Did you check in Windows Functionality Suite ?[/quote]
    Yep, I understand the conditional. I took a look at WFS, I don’t see any methods that help though.

Well I have another issue with HiDPI on Windows and Toolbars:

Retina support on Mac works pretty good for me and I am replacing all images with x2 images there. But on Windows this doesn’t seem to work. The replaced graphics in the Toolbar are more worse than the regular ones:

Here are 2 Screenshots, the 1st one with 2x Images for toolbar:

the 2nd screenshot with normal ones:

I am missing something?

I cannot edit my last post… ere is the first image:

You see the normal ones are better than the Retina x2 images… quite unlogical to me…

What are the images file names ?

own naming convention (external32 and external32x2), In an IF clause I am checking Scalefactor (sf) and if HiDPI I swap them:

[code] // Alle Pushbuttons Resetten
For i = 0 to TOOLBAR_Main1.Count

  If TOOLBAR_Main1.Item(i) IsA ToolButton then
    
    t = TOOLBAR_Main1.Item(i)
    
    if ToolButton(t).Name = "tbNewLease" then 
      ToolButton(t).Enabled = (NumberOfAvailableKeys > 0) and (NumberOfContacts > 0) 
      ToolButton(t).Icon = if(sf > 1, external32x2, external32)
    end if


[/code]