From Anna Sokol, "There is no need to specify WINVER of 0x0603 in order to check for the SetProcessDPIAwareness function existence.

If your current OS where the application is running is Windows 8.1 or above it the function will exist in the dll or if its below it wont.
I checked the attached code with both a Windows 7 desktop (where the function doesn't exist) and a Windows 10 tablet (where it does and had my screen scaled to 150%) and in both cases the code worked as intended."
This commit is contained in:
Anna Sokol 2017-12-04 13:01:52 +00:00 committed by Robert Osfield
parent 1810c9e7e3
commit 279df6d57e

View File

@ -96,9 +96,9 @@ enum tagPOINTER_INPUT_TYPE {
PT_TOUCH = 0x00000002, // Touch
PT_PEN = 0x00000003, // Pen
PT_MOUSE = 0x00000004, // Mouse
#if(WINVER >= 0x0603)
//#if(WINVER >= 0x0603)
PT_TOUCHPAD = 0x00000005, // Touchpad
#endif /* WINVER >= 0x0603 */
//#endif /* WINVER >= 0x0603 */
};
typedef DWORD POINTER_INPUT_TYPE;
@ -145,7 +145,7 @@ static GetTouchInputInfoFunc *getTouchInputInfoFunc = NULL;
static GetPointerTypeFunc *getPointerTypeFunc = NULL;
// DPI Awareness
#if(WINVER >= 0x0603)
// #if(WINVER >= 0x0603)
#ifndef DPI_ENUMS_DECLARED
@ -163,7 +163,7 @@ BOOL
PROCESS_DPI_AWARENESS dpi_awareness));
static SetProcessDpiAwarenessFunc *setProcessDpiAwareness = NULL;
#endif
// #endif
@ -787,7 +787,7 @@ Win32WindowingSystem::Win32WindowingSystem()
}
#if(WINVER >= 0x0603)
// #if(WINVER >= 0x0603)
// For Windows 8.1 and higher
//
// Per monitor DPI aware.This app checks for the DPI when it is created and adjusts the scale factor
@ -799,7 +799,7 @@ Win32WindowingSystem::Win32WindowingSystem()
(*setProcessDpiAwareness)(PROCESS_DPI_AWARENESS::PROCESS_PER_MONITOR_DPI_AWARE);
}
}
#endif
// #endif
}
Win32WindowingSystem::~Win32WindowingSystem()