Problems with high DPI on win10

Started by Zlatko Vid, July 01, 2024, 08:00:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zlatko Vid

Hi Charles ..all ...
 
one of my "customer" / complainer / pain_I_T_A  ;D
telling me that my code editor (written in o2)
have problems with high DPI on win10...telling me stories how i use
old monitor ..but is not problem in monitor then in stupid scalling in win10
so i tried on win10 laptop and damn he have a right

only thing i found about this is this tiny VB example
anyone have something better?
Option Explicit

Private Enum PROCESS_DPI_AWARENESS
    Process_DPI_Unaware = 0
    Process_System_DPI_Aware = 1
    Process_Per_Monitor_DPI_Aware = 2
End Enum
#If False Then
    Dim Process_DPI_Unaware, Process_System_DPI_Aware, Process_Per_Monitor_DPI_Aware
#End If

Private Declare Function SetProcessDpiAwareness Lib "shcore.dll" (ByVal Value As PROCESS_DPI_AWARENESS) As Long

Private Sub Main()
    Const S_OK = &H0&, E_INVALIDARG = &H80070057, E_ACCESSDENIED = &H80070005

    Select Case SetProcessDpiAwareness(Process_System_DPI_Aware)
        Case S_OK:           MsgBox "The current process is set as dpi aware.", vbInformation
        Case E_INVALIDARG:   MsgBox "The value passed in is not valid.", vbCritical
        Case E_ACCESSDENIED: MsgBox "The DPI awareness is already set, either by calling this API " & _
                                    "previously or through the application (.exe) manifest.", vbCritical
    End Select
End Sub

Zlatko Vid

on stackovrflow is explained

QuoteThat's it. Feel free to call SetProcessDPIAwareness on 8.1 and later, and fall back to SetProcessDPIAware on earlier versions. Of course, I'd just remove the dpi aware section from the manifest. 

so ..what manifedt have with DPI scalling ?
Is manifest different for win10 ?

Zlatko Vid

on pinvoke is this define :

Declare Function SetProcessDPIAware Lib "user32.dll" () As Boolean

Zlatko Vid



Zlatko Vid

It looks that is only me who post about it
well i don't think about it before