SetProcessDpiAwareness

This commit is contained in:
tildearrow 2022-10-20 03:34:12 -05:00
parent bfeb57c3b7
commit 3de0e6bc9f
1 changed files with 18 additions and 0 deletions

View File

@ -19,6 +19,8 @@
#include "utfutils.h"
typedef HRESULT (*SPDA)(int);
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prevInst, PSTR args, int state) {
int argc=0;
wchar_t** argw=CommandLineToArgvW(GetCommandLineW(),&argc);
@ -29,5 +31,21 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prevInst, PSTR args, int state) {
argv[i]=new char[str.size()+1];
strcpy(argv[i],str.c_str());
}
// set DPI awareness
HMODULE shcore=LoadLibraryW(L"shcore.dll");
if (shcore!=NULL) {
SPDA ta_SetProcessDpiAwareness=(SPDA)GetProcAddress(shcore,"SetProcessDpiAwareness");
if (ta_SetProcessDpiAwareness!=NULL) {
HRESULT result=ta_SetProcessDpiAwareness(2);
if (result!=S_OK) {
// ???
}
}
if (!FreeLibrary(shcore)) {
// ???
}
}
return main(argc,argv);
}