Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DPI_AWARENESS_CONTEXT enum values missing #417

Closed
shravan2x opened this issue Jul 8, 2023 · 2 comments
Closed

DPI_AWARENESS_CONTEXT enum values missing #417

shravan2x opened this issue Jul 8, 2023 · 2 comments

Comments

@shravan2x
Copy link

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
Copy link
Owner

dahall commented Jul 8, 2023

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.

@dahall dahall closed this as completed Jul 8, 2023
@shravan2x
Copy link
Author

Thanks for adding them!

dahall added a commit that referenced this issue Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants