![]() Here are screenshots of the created windows with PB 5.31 and PB 5.40 beta 8 on DPI settings 125% and 200%. Until WaitWindowEvent() = #PB_Event_CloseWindow MessageRequester("Error", "Unable to open main window.") MessageRequester("Error", "Unable to load font.") G_ScaleDPIy = GetDeviceCaps_(hdc, #LOGPIXELSY) / 96.0įont = LoadFont(#PB_Any, "Segoe UI", 9, #PB_Font_HighQuality) G_ScaleDPIx = GetDeviceCaps_(hdc, #LOGPIXELSX) / 96.0 96 is the default DPI value on Windows Hdc = GetDC_(#Null) get handle to the device context for the entire screen If SetProcessDpiAwareness(#Process_System_DPI_Aware) = #S_OK SetProcessDpiAwareness = GetFunction(shcore, "SetProcessDpiAwareness") If the exe is allready dpi aware (like through a manifest), then we skip using If GetProcessDpiAwareness(#Null, dpiaware) = #S_OK GetProcessDpiAwareness = GetFunction(shcore, "GetProcessDpiAwareness") Shcore = OpenLibrary(#PB_Any, "shcore.dll") Only use this in EXEs, as DLLs inherit DPI from the calling process.ĬompilerIf #PB_Compiler_ExecutableFormat = #PB_Compiler_Executable Protected.i shcore, hdc, dpiaware=#Process_DPI_Unaware Protected SetProcessDpiAwareness.pSetProcessDpiAwareness Protected GetProcessDpiAwareness.pGetProcessDpiAwareness Global.f g_ScaleDPIx=1.0, g_ScaleDPIy=1.0 Prototype.i pSetProcessDpiAwareness (level.i) Prototype.i pGetProcessDpiAwareness (hprocess.i, *level) Constants for Get/SetProcessDpiAwareness() ![]() Code: Select all - Windows 8.1+ (tested on Windows 10) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |