DXGL r411 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r410
|
r411
|
r412
>
Date:
17:17, 15 December 2013
Author:
admin
Status:
new
Tags:
Comment:
Support "Enabled" setting for DPI scaling.
Modified paths:
/cfgmgr/cfgmgr.cpp
(modified) (
history
)
Diff
[
purge
]
Index: cfgmgr/cfgmgr.cpp
—
—
@@ -332,8 +332,37 @@
333
333
ReadSettings(hKey,cfg,NULL,false,true,NULL);
334
334
RegCloseKey(hKey);
335
335
hKey = NULL;
336
+ HMODULE hSHCore = NULL;
337
+ HMODULE hUser32 = NULL;
336
338
if (initial)
337
339
{
340
+ if (cfg->DPIScale == 1)
341
+ {
342
+ bool DPIAwarePM = false;
343
+ hSHCore = LoadLibrary(_T("SHCore.dll"));
344
+ if (hSHCore)
345
+ {
346
+ HRESULT(WINAPI *_SetProcessDpiAwareness)(DWORD value)
347
+ = (HRESULT(WINAPI*)(DWORD))GetProcAddress(hSHCore, "SetProcessDpiAwareness");
348
+ if (_SetProcessDpiAwareness)
349
+ {
350
+ DPIAwarePM = true;
351
+ _SetProcessDpiAwareness(2);
352
+ }
353
+ }
354
+ if (!DPIAwarePM)
355
+ {
356
+ hUser32 = LoadLibrary(_T("User32.dll"));
357
+ if (hUser32)
358
+ {
359
+ BOOL(WINAPI *_SetProcessDPIAware)()
360
+ = (BOOL(WINAPI*)())GetProcAddress(hUser32, "SetProcessDPIAware");
361
+ if (_SetProcessDPIAware) _SetProcessDPIAware();
362
+ }
363
+ }
364
+ if (hSHCore) FreeLibrary(hSHCore);
365
+ if (hUser32) FreeLibrary(hUser32);
366
+ }
338
367
HMODULE hKernel32 = LoadLibrary(_T("kernel32.dll"));
339
368
BOOL (WINAPI *iswow64)(HANDLE,PBOOL) = NULL;
340
369
if(hKernel32) iswow64 = (BOOL(WINAPI*)(HANDLE,PBOOL))GetProcAddress(hKernel32,"IsWow64Process");
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version