Set process DPI aware on Windows/MSVC
This commit is contained in:
parent
fe10a149e5
commit
6fa2be3ce5
11
main.cpp
11
main.cpp
@ -17,6 +17,17 @@ int main() {
|
|||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
SetProcessDPIAware();
|
SetProcessDPIAware();
|
||||||
|
#else
|
||||||
|
HINSTANCE user32Dll = LoadLibraryA("user32.dll");
|
||||||
|
if (user32Dll) {
|
||||||
|
typedef BOOL(WINAPI * SetProcessDPIAwareFuncType)();
|
||||||
|
SetProcessDPIAwareFuncType setProcessDPIAwareFunc = (SetProcessDPIAwareFuncType)GetProcAddress(user32Dll, "SetProcessDPIAware");
|
||||||
|
if (setProcessDPIAwareFunc) {
|
||||||
|
if (!setProcessDPIAwareFunc())
|
||||||
|
WARN("failed to set process DPI awareness");
|
||||||
|
}
|
||||||
|
FreeLibrary(user32Dll);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
HWND win = initgraph(SCREEN_WIDTH, SCREEN_HEIGHT);
|
HWND win = initgraph(SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
SetWindowTextA(win, "JacksEscape");
|
SetWindowTextA(win, "JacksEscape");
|
||||||
|
Loading…
Reference in New Issue
Block a user