' ########################################################################################
' Microsoft Windows
' File: ShellScalingApi.inc
' Copyright (c) 2020 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_ShellScalingApi_PBI)
#DEFINE PBX_ShellScalingApi_PBI
%EQUATE `SHELLSCALINGAPI_INC = 1
'/* header files for imported files */
'#INCLUDE ONCE "shtypes.inc"
' // This enum should be added to shtypes.inc and removed from here
' enum DEVICE_SCALE_FACTOR
%EQUATE `DEVICE_SCALE_FACTOR_INVALID = 0
%EQUATE `SCALE_100_PERCENT = 100
%EQUATE `SCALE_120_PERCENT = 120
%EQUATE `SCALE_125_PERCENT = 125
%EQUATE `SCALE_140_PERCENT = 140
%EQUATE `SCALE_150_PERCENT = 150
%EQUATE `SCALE_160_PERCENT = 160
%EQUATE `SCALE_175_PERCENT = 175
%EQUATE `SCALE_180_PERCENT = 180
%EQUATE `SCALE_200_PERCENT = 200
%EQUATE `SCALE_225_PERCENT = 225
%EQUATE `SCALE_250_PERCENT = 250
%EQUATE `SCALE_300_PERCENT = 300
%EQUATE `SCALE_350_PERCENT = 350
%EQUATE `SCALE_400_PERCENT = 400
%EQUATE `SCALE_450_PERCENT = 450
%EQUATE `SCALE_500_PERCENT = 500
'// The scaling API only operates over the primary display and the immersive display. Scaling information
'// is not provided for displays other than those.
'// This enum matches #defines in IETouch.h. Don't update this without keeping that in sync.
#IF NOT %DEF(%SCALING_ENUMS_DECLARED)
%EQUATE `SCALING_ENUMS_DECLARED = 1
 '--- enum DISPLAY_DEVICE_TYPE
 %DEVICE_PRIMARY = 0
 %DEVICE_IMMERSIVE = 1
 '--- enum SCALE_CHANGE_FLAGS
 %SCF_VALUE_NONE = &H00
 %SCF_SCALE = &H01
 %SCF_PHYSICAL = &H02
#ENDIF
'// Given a display device, return the preferred DEVICE_SCALE_FACTOR to be used for scaling values.
'// Default is SCALE_100_PERCENT
'STDAPI_(DEVICE_SCALE_FACTOR) GetScaleFactorForDevice(_In_ DISPLAY_DEVICE_TYPE deviceType);
DECLARE FUNCTION GetScaleFactorForDevice LIB "shcore.dll" ALIAS "GetScaleFactorForDevice" ( BYVAL deviceType AS LONG ) AS QUAD ' DEVICE_SCALE_FACTOR enum
'// Register a window to receive callbacks when scaling information changes. The uMsgNotify param specifies a message
'// that will be posted to the requesting window. The wParam for this message is a combination of SCALE_CHANGE_FLAGS
'// Deprecated as of Windows 8.1. Use RegisterScaleChangeEvent
'STDAPI RegisterScaleChangeNotifications(_In_ DISPLAY_DEVICE_TYPE displayDevice, _In_ HWND hwndNotify, _In_ UINT uMsgNotify, _Out_ DWORD *pdwCookie);
'// Deprecated as of Windows 8.1. Use UnregisterScaleChangeEvent
'STDAPI RevokeScaleChangeNotifications(_In_ DISPLAY_DEVICE_TYPE displayDevice, _In_ DWORD dwCookie);
'STDAPI GetScaleFactorForMonitor(_In_ HMONITOR hMon, _Out_ DEVICE_SCALE_FACTOR *pScale);
DECLARE FUNCTION GetScaleFactorForMonitor LIB "shcore.dll" ALIAS "GetScaleFactorForMonitor" ( BYVAL hMon AS QUAD,
 BYREF pScale AS LONG
 ) AS LONG
'STDAPI RegisterScaleChangeEvent(_In_ HANDLE hEvent, _Out_ DWORD_PTR *pdwCookie);
DECLARE FUNCTION RegisterScaleChangeEvent LIB "shcore.dll" ALIAS "RegisterScaleChangeEvent" ( BYVAL hEvent AS QUAD,
 BYREF pdwCookie AS DWORD
 ) AS LONG
'STDAPI UnregisterScaleChangeEvent(_In_ DWORD_PTR dwCookie);
DECLARE FUNCTION UnregisterScaleChangeEvent LIB "shcore.dll" ALIAS "UnregisterScaleChangeEvent" ( BYVAL dwCookie AS QUAD ) AS LONG
#IF NOT %DEF(%DPI_ENUMS_DECLARED)
%EQUATE `DPI_ENUMS_DECLARED = 1
 '--- enum PROCESS_DPI_AWARENESS
 %PROCESS_DPI_UNAWARE = 0
 %PROCESS_SYSTEM_DPI_AWARE = 1
 %PROCESS_PER_MONITOR_DPI_AWARE = 2
 '--- enum MONITOR_DPI_TYPE
 %MDT_EFFECTIVE_DPI = 0
 %MDT_ANGULAR_DPI = 1
 %MDT_RAW_DPI = 2
 %MDT_DEFAULT = %MDT_EFFECTIVE_DPI
#ENDIF
'STDAPI SetProcessDpiAwareness(
' _In_ PROCESS_DPI_AWARENESS value);
DECLARE FUNCTION SetProcessDpiAwareness LIB "shcore.dll" ALIAS "SetProcessDpiAwareness" ( BYVAL value AS LONG ) AS LONG
'STDAPI GetProcessDpiAwareness(
' _In_opt_ HANDLE hprocess,
' _Out_ PROCESS_DPI_AWARENESS *value);
DECLARE FUNCTION GetProcessDpiAwareness LIB "shcore.dll" ALIAS "GetProcessDpiAwareness" ( BYVAL hprocess AS QUAD,
 BYREF value AS LONG
 ) AS LONG
'STDAPI GetDpiForMonitor(
' _In_ HMONITOR hmonitor,
' _In_ MONITOR_DPI_TYPE dpiType,
' _Out_ UINT *dpiX,
' _Out_ UINT *dpiY);
DECLARE FUNCTION GetDpiForMonitor LIB "shcore.dll" ALIAS "GetDpiForMonitor" ( BYVAL hmonitor AS QUAD,
 BYVAL dpiType AS LONG,
 BYREF dpiX AS DWORD,
 BYREF dpiY AS DWORD
 ) AS LONG
#ENDIF
