1

Calling this for example:

auto res = GetThreadDpiAwarenessContext();

https://learn.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getthreaddpiawarenesscontext

Gives an error about "cannot find procedure entry point in user32.dll" when run on older windows (eg. win 8). This seems to happend just about when the .exe has finished static .dll loading (so before any actual user code has been run).

While this is not strange, since it is clearly documented to be available from windows 10, is there a way to make the application backward compatible ?

darune
  • 10,480
  • 2
  • 24
  • 62
  • There is a [process version](https://learn.microsoft.com/en-us/windows/desktop/api/shellscalingapi/nf-shellscalingapi-getprocessdpiawareness). Not sure if there is a thread version pre windows 10. – NathanOliver Mar 12 '19 at 12:56
  • 1
    use `GetProcAddress` to get the address of the function at runtime – Alan Birtles Mar 12 '19 at 12:57

1 Answers1

1

Load the function dynamically at runtime, either by using your linker's delay-loading feature, or using GetProcAddress() directly in your code (the linker's delay loader uses GetProcAddress() internally for you).

Original answer from Remy LeBeau

MSalters
  • 173,980
  • 10
  • 155
  • 350