mingw-cross-env-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mingw-cross-env-list] mxe SetProcessDPIAware/ness


From: Dave Lawrence
Subject: Re: [Mingw-cross-env-list] mxe SetProcessDPIAware/ness
Date: Wed, 20 Jul 2016 10:52:11 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

Hi,

Thanks for the workaround suggestion, I will keep that in mind for the future.

In this instance I have discovered you can use a Windows Manifest to enable DPI Awareness:

// resources.rc

#include <windows.h>

10 ICON "app.ico"
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "app.manifest"

// app.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
  <asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings";>
      <dpiAware>true</dpiAware>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>

br,


On 20/07/16 09:35, Nagaev Boris wrote:
On Tue, Jul 19, 2016 at 1:06 AM, Dave Lawrence
<address@hidden> wrote:
I want to add SetProcessDPIAware[ness] to my cross-compiled application.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms633543(v=vs.85).aspx

https://msdn.microsoft.com/en-us/library/windows/desktop/dn302122(v=vs.85).aspx

MXE (master) seems to have a header definition for SetProcessDPIAware (only)

#if _WIN32_WINNT >= 0x0600
#define USER_DEFAULT_SCREEN_DPI 96

   WINUSERAPI WINBOOL WINAPI SetProcessDPIAware (VOID);
   WINUSERAPI WINBOOL WINAPI IsProcessDPIAware (VOID);
#endif
#endif

but there is no symbol in libuser32.a for either

can anyone help?

Thanks,


Hi,

most packages of MXE are Windows XP compatible. Windows XP doesn't
have these functions.

As a workaround, you can load the function in runtime using
GetModuleHandle and GetProcAddress. If it fails, then the OS does not
have this function and you can handle this situation (e.g., fail or
fall back to some default values).

See (not yet committed) patch for libui which solved similar problem
for function TaskDialog:
https://gist.github.com/71f871ba6d7cd6f53ceb40d6c98f66b7

Is there a better way of using function appeared in post-XP Windows?






reply via email to

[Prev in Thread] Current Thread [Next in Thread]