SteveSandersonMS / WebWindow

.NET Core library to open native OS windows containing web UI on Windows, Mac, and Linux. Experimental.
Apache License 2.0
1.99k stars 215 forks source link

Windows 7 - DLLNotFoundException #126

Closed Progmasys closed 3 years ago

Progmasys commented 3 years ago

I've been trying to build WebWindow on a x64 Windows 7 machine but every time it fails with:

System.TypeInitializationException: 'The type initializer for 'WebWindows.WebWindow' threw an exception.' DllNotFoundException: Unable to load DLL 'WebWindow.Native' or one of its dependencies. (0x8007007F).

I already tried a lot of things. Reinstaling Visual C++, different versions of WebView2 and Chromium Edge (beta, dev) but nothing worked. And this only happens on Windows 7.

Any ideas on what's causing this issue?

Progmasys commented 3 years ago

Found the problem. GetDpiForWindow(_hWnd) is Windows 10 only. Changing WebWindow::GetScreenDpi solved it for now.

unsigned int WebWindow::GetScreenDpi() {
if (IsWindows10OrGreater) { return GetDpiForWindow(_hWnd); } else { return 0; }
}