SetProcessDPIAware - how to add it in manifest?

My Windows application has some problem, when Windows settings has non 100% scale. I fixed them using call of function SetProcessDPIAware before creating first window, but official documentation says, that it is not recommended way, and I should change a manifest: Setting the default DPI awareness for a process (Windows) - Win32 apps | Microsoft Learn
There is an XML on related page, but how can I use it in Rust project?

I haven't used it myself, but I believe winres can set the manifest for you

1 Like

I looked to the example - is it the function which I should call from "build.rs", not from target application, isn't it?

Yes, I believe the manifest is embedded in the executable, and Windows reads it when launching the program

2 Likes

If you’re only compiling with the Rust MSVC target, you can also just do what rustc does in its build.rs and not need any other software: rust/build.rs at e3dfeeaa45f117281b19773d67f3f253de65cee1 · rust-lang/rust · GitHub

I also have a crate to do this for you for both GNU and MSVC, including when cross-compiling: https://crates.io/crates/embed-manifest

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.