From e42a5cea5f9a96ab2db03517bb602ade0a03260e Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Mon, 30 Jul 2018 14:29:27 +0200 Subject: [PATCH] request physical desktop resolution --- windows-snapshot-tool/bin/freeze.exe | Bin 401414 -> 402138 bytes windows-snapshot-tool/src/ShellScalingApi.h | 80 ++++++++++++++++++++ windows-snapshot-tool/src/main.cpp | 34 +++++++-- 3 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 windows-snapshot-tool/src/ShellScalingApi.h diff --git a/windows-snapshot-tool/bin/freeze.exe b/windows-snapshot-tool/bin/freeze.exe index 8ea7bbc563815964e8de95e1dcd8bd390372cb34..c3347ba13df3ff38287fcc53c6ae4430ace09d1d 100755 GIT binary patch delta 16650 zcmb_j3tUxIx?g*ry%3S~h=3@FJdS{XhRQ2bJ0g&okE1bWih|F~j7TvZGeJd@PzT-S zvT_s+&2b#H;CApCrKNVsm~u+Z42_D6l+4T=ll%YnKId?Dr{>-}zu7;(z1IGJ|LJDHd)l;~SQE%XG zRzpqEQnH$f`y@3F_ZjL2-1F2UxGz$_GA)ReqZvD{SXyv3zTTCw(twqZTG=Z#bUTLI zR`XmdD={}d-C13!gvr%W>MrGxHs!Ha)>zy{_2JpF9Hq|WJ*2DZ8a`R7Q=9p8sazfF zWr>&J4zAhVR@M?wJIBhFH7T#Gf=>d?aPYl_vBvBm#ITIc!jOx`H8>vAKsi%B`Yy)M+&So^8<*UY6*@cs5c^RcY zpM7>k2YbefqFUb>B^kwMpD6xxV$swI-AjSmajLGUFwNN>Sdo;Z;Y;xl59(m zYH1f!SnP-~;S~!SX6q^~l9IPqXRN38Eb+H&&2Ozm!?I@^Si#WJjP=WIN{g+f84b&7 zlv3wd7=(syoEFO1@|q6oYl>?Mx;GwIsD~SWXMDRAo*=N?0h$rQ3lu`1(u~@H zekR7|@kTq6)fpPE-oaBG&#Roz-)=6=s9Qb#=7dQT-!?N0`iGV^C2plLb5Dlvylz?$ zRM1YR!Sb4UZK_ch)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src/ShellScalingApi.h new file mode 100644 index 0000000..797c460 --- /dev/null +++ b/windows-snapshot-tool/src/ShellScalingApi.h @@ -0,0 +1,80 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#ifndef _SHELLSCALINGAPI_H_ +#define _SHELLSCALINGAPI_H_ + +#include +#include + +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + +#ifndef SCALING_ENUMS_DECLARED +typedef enum { + SCF_VALUE_NONE = 0x00, + SCF_SCALE = 0x01, + SCF_PHYSICAL = 0x02 +} SCALE_CHANGE_FLAGS; +DEFINE_ENUM_FLAG_OPERATORS(SCALE_CHANGE_FLAGS); + +typedef enum { + DEVICE_PRIMARY = 0, + DEVICE_IMMERSIVE = 1 +} DISPLAY_DEVICE_TYPE; + +#define SCALING_ENUMS_DECLARED +#endif /* SCALING_ENUMS_DECLARED */ + +#if NTDDI_VERSION >= NTDDI_WIN8 +STDAPI_(DEVICE_SCALE_FACTOR) GetScaleFactorForDevice(DISPLAY_DEVICE_TYPE deviceType); +STDAPI RegisterScaleChangeNotifications(DISPLAY_DEVICE_TYPE displayDevice, HWND hwndNotify, UINT uMsgNotify, + DWORD *pdwCookie); +STDAPI RevokeScaleChangeNotifications(DISPLAY_DEVICE_TYPE displayDevice, DWORD dwCookie); +#endif /* NTDDI_VERSION >= NTDDI_WIN8 */ + +#ifndef DPI_ENUMS_DECLARED +typedef enum MONITOR_DPI_TYPE { + MDT_EFFECTIVE_DPI = 0, + MDT_ANGULAR_DPI = 1, + MDT_RAW_DPI = 2, + MDT_DEFAULT = MDT_EFFECTIVE_DPI +} MONITOR_DPI_TYPE; + +typedef enum PROCESS_DPI_AWARENESS { + PROCESS_DPI_UNAWARE = 0, + PROCESS_SYSTEM_DPI_AWARE = 1, + PROCESS_PER_MONITOR_DPI_AWARE = 2 +} PROCESS_DPI_AWARENESS; + +#define DPI_ENUMS_DECLARED +#endif /* DPI_ENUMS_DECLARED */ + +#if NTDDI_VERSION >= NTDDI_WINBLUE +STDAPI GetScaleFactorForMonitor(HMONITOR hMon, DEVICE_SCALE_FACTOR *pScale); +STDAPI RegisterScaleChangeEvent(HANDLE hEvent, DWORD_PTR *pdwCookie); +STDAPI UnregisterScaleChangeEvent(DWORD_PTR dwCookie); + +STDAPI GetDpiForMonitor(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType, UINT *dpiX, UINT *dpiY); +STDAPI GetProcessDpiAwareness(HANDLE hprocess, PROCESS_DPI_AWARENESS *value); +STDAPI SetProcessDpiAwareness(PROCESS_DPI_AWARENESS value); +#endif /* NTDDI_VERSION >= NTDDI_WINBLUE */ + +#if NTDDI_VERSION >= NTDDI_WINTHRESHOLD +#ifndef SHELL_UI_COMPONENT_ENUMS_DECLARED +typedef enum { + SHELL_UI_COMPONENT_TASKBARS = 0, + SHELL_UI_COMPONENT_NOTIFICATIONAREA = 1, + SHELL_UI_COMPONENT_DESKBAND = 2 +} SHELL_UI_COMPONENT; + +#define SHELL_UI_COMPONENT_ENUMS_DECLARED +#endif /* SHELL_UI_COMPONENT_ENUMS_DECLARED */ + +UINT WINAPI GetDpiForShellUIComponent(SHELL_UI_COMPONENT component); +#endif /* NTDDI_VERSION >= NTDDI_WINTHRESHOLD */ + +#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ +#endif /* _SHELLSCALINGAPI_H_ */ diff --git a/windows-snapshot-tool/src/main.cpp b/windows-snapshot-tool/src/main.cpp index cac1fc5..92ec8b8 100644 --- a/windows-snapshot-tool/src/main.cpp +++ b/windows-snapshot-tool/src/main.cpp @@ -1,4 +1,7 @@ +//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +//#include #include "resource.h" +//#include #include //#include "LimitSingleInstance.h" @@ -30,6 +33,9 @@ int WINAPI WinMain (HINSTANCE hThisInstance, LPSTR lpszArgument, int nCmdShow) { +// SetProcessDPIAware(); +// SetProcessDPIAwareness(); + // kill other already running instances HWND existingApp = FindWindow(0, szClassName); if (existingApp) @@ -38,6 +44,12 @@ int WINAPI WinMain (HINSTANCE hThisInstance, Sleep(2000); // give the other App some time to clean up and close } + HDC screen = GetDC(0); + FLOAT dpiX, dpiY; + dpiX = static_cast(GetDeviceCaps(screen, LOGPIXELSX)); + dpiY = static_cast(GetDeviceCaps(screen, LOGPIXELSY)); + ReleaseDC(NULL,screen); + /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ @@ -69,8 +81,8 @@ int WINAPI WinMain (HINSTANCE hThisInstance, WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ - 544, /* The programs width */ - 375, /* and height in pixels */ + static_cast(dpiX * 544.f / 96.f), /* The programs width */ + static_cast(dpiY * 375.f / 96.f), /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ @@ -348,6 +360,8 @@ int CaptureImage(HWND hWnd, const wchar_t* filename) { HBITMAP hbmScreen = NULL; BITMAP bmpScreen; + SetProcessDPIAware(); + // Retrieve the handle to a display device context for the client // area of the window. hdcScreen = GetDC(NULL); @@ -402,10 +416,18 @@ int CaptureImage(HWND hWnd, const wchar_t* filename) { return -1; } - int width = GetDeviceCaps(hdcScreen, HORZRES); - int height = GetDeviceCaps(hdcScreen, VERTRES); + //int width = GetDeviceCaps(hdcScreen, HORZRES); + //int height = GetDeviceCaps(hdcScreen, VERTRES); + //int width_factor = GetDeviceCaps(hdcScreen, SCALINGFACTORX); + //int height_factor = GetDeviceCaps(hdcScreen, SCALINGFACTORY); + int desktop_width = GetDeviceCaps(hdcScreen, DESKTOPHORZRES); + int desktop_height = GetDeviceCaps(hdcScreen, DESKTOPVERTRES); + + //wchar_t res_info[200]; + //swprintf (res_info, 200-1, L"HORZRES: %d\nVERTRES: %d\nSCALINGFACTORX: %d\nSCALINGFACTORY: %d\nDESKTOPHORZRES: %d\nDESKTOPVERTZRES: %d\n", width, height, width_factor, height_factor, desktop_width, desktop_height); + //MessageBox(hWnd, res_info,L"Resolution info", MB_OK); - HBITMAP hBmp = CreateCompatibleBitmap(hdcScreen, width, height); + HBITMAP hBmp = CreateCompatibleBitmap(hdcScreen, desktop_width, desktop_height); // Select the compatible bitmap into the compatible memory DC. SelectObject(hdcMemDC,hBmp); @@ -413,7 +435,7 @@ int CaptureImage(HWND hWnd, const wchar_t* filename) { // Bit block transfer into our compatible memory DC. if(!BitBlt(hdcMemDC, 0,0, - width, height, + desktop_width, desktop_height, hdcScreen, 0,0, SRCCOPY))