dahall/Vanara

DPI_AWARENESS_CONTEXT enum values missing

shravan2x opened this issue · 2 comments

I'm trying to set the DPI awareness of my application using this piece of code:

User32.SetProcessDpiAwarenessContext(new User32.DPI_AWARENESS_CONTEXT(User32.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE));

The issue is that the DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE enum value defined at https://learn.microsoft.com/en-us/windows/win32/hidpi/dpi-awareness-context doesn't seem to be a constant in the library. Are DPI_AWARENESS_CONTEXT enum values defined somewhere else?

I see one enum at User32.DPI_AWARENESS, but this is both out of date and the values are incorrect. For example, DPI_AWARENESS_SYSTEM_AWARE has a value of 1 when it should be -2.

dahall commented

I've added those constants to the DPI_AWARENEXT_CONTEXT struct. You can use them like follows:

User32.SetProcessDpiAwarenessContext(User32.DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE);

You can pull this build from AppVeyor (see home page) or wait about a week for my next release.

Thanks for adding them!