Open dandy518 opened 6 months ago
@dandy518 could you provide test app/code? I set a local app to DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED and the window is positioned correctly.
@johna-ms Hi. I used code https://github.com/MicrosoftEdge/WebView2Samples/tree/main/SampleApps/WebView2APISample Did you set the monitor scaled to 100% over?
Yes. Could you share a screenshot of the window misplacement?
@johna-ms
Ok I am seeing this repro for visual hosting. Could you confirm if you are using normal windowed mode hosting? Does this repro when launching the sample app normally? Or are you changing the hosting mode by navigating to the 'window' submenu?
@johna-ms Use normal window.
I'm only using the sample app(WebView2APISample) by changing it as below.
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdLine, int nCmdShow) { g_hInstance = hInstance; UNREFERENCED_PARAMETER(hPrevInstance); g_nCmdShow = nCmdShow;
// Default DPI awareness to PerMonitorV2. The commandline parameters can
// override this.
**DPI_AWARENESS_CONTEXT dpiAwarenessContext = DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED;// DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2;**
..... }
@dandy518 what specific version of Win10 are you on? The Windows team put in a fix for this for Win11, but I'm not sure if it got backported to Win10 or all Win10 versions.
Our customer reports the same problem with his software on windows 10 (22H2) machines :( Subscribing to this issue.
@champnic Hi. Sorry for the late reply. Win10 version is 22H2 19045.4046
Are you able to see the same problem if you run on Win11?
Our software works on all win11 machines flawless. Only windows 10 machines (22h2) have the issue. Sadly our company (software development) has win 11 rolled out. But the customer has windows 10 rolled out. And there is no way for us to downgrade or the customer to upgrade. Well one day they will upgrade to Windows 11 of course, but as for a lot of large global companies (like this customer), IT progress is quite behind when it comes to installing the latest versions. Win 10 + .net 6 it is here for the next overseeable time. And no way to delay the software release till they use windows 11 :(
@champnic There's also a problem with win11
@dandy518 @IceReaper Thanks for confirming. This all matches that Windows put in a fix, but they haven't backported it to earlier versions. @dandy518 I assume if you updated your Windows 11 version you would see this start to work correctly.
I'll try to push on the Windows team to backport this fix. Thanks!
Confirmed that Windows had found a remaining issue on Win10 and has checked in a fix as of April. It looks like it should be part of a servicing update around July 2024.
What happened?
If the monitor scaled is over 100% and the SetProcessDpiAwarenessContext setting is DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED, there is a problem that the rendering window is misplaced, so is there a solution?
Importance
Important. My app's user experience is significantly compromised.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
122.0.2365.92
SDK Version
2470.0
Framework
Win32
Operating System
Windows 10
OS Version
No response
Repro steps
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response
AB#50881859