From 31fda2791a41561f84d973b64eb22dae0d6ee609 Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Wed, 18 Jul 2018 23:41:36 +0200 Subject: [PATCH] next try --- windows-snapshot-tool/bin/freeze.exe | Bin 398083 -> 398083 bytes windows-snapshot-tool/src/main.cpp | 16 ++++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/windows-snapshot-tool/bin/freeze.exe b/windows-snapshot-tool/bin/freeze.exe index 183bf6b318e6dddd6e15d5d7bf9649f294ed829c..7e68698462fae8a5bd72932f70c6d35b85e2da25 100755 GIT binary patch delta 6925 zcmZ`;3tW{|w%>c7ZzCb$;UN$L9ykXY z{G7H<53wAZCMy#4^HrL9$MQOjm1QX!TFu}yHLLq;OzwYu=Nv%me*QLVt^a!Lwby=v zm7Ag~H$~Sj6+boBEgK=;Tvm5tlPF7ST*RBiox;J`AuVueJOY0^UN9ap68{eV7 zu1)IHknCbDYa;a^StNvApDB}gtG-fRObLrJ{jBLO*4njxj*C@Z)Lvaa!$rZE6;4+Z z7;7o%s=pGjfxoL4bn0WDYGZ6gDX-3PwEPilb^eW-kvFQ#9D&uEqk5P_Yng1**LR8) z38DJCol^NWy`@uv7+}*o2fBo`>B9qU{8N2);PBk4?u?y#`j^($8h7ov=9{gp2+-mI zxMDlQw_-2-th^X}NX|z>970Q`RlgD#FG8%k^^SOcv+?dbL;&BbXLp$|LZbD}UA_?g zqx8krgs4!AtI~Zv@LX?Hr1rxDU~4=!`{^xt08z}&;2#S|5^jX#7KK=m#T$G;81}hn6d&5+~Pr%3LIL>DE)U~ zGlbOiXG8BvY_5i?#{CV5R^z^iA#I38SzC`{Al2@s8h4YvGc=Q5)LTOP#nk;jA*WJE z2XE3xhm9`ZEGXRuic8%^!v|3)u+ty-P}NKfGsVaC z)X-x!?qihAa$h!DwfiXbz8~3AvTTK!9rBN;aUTV-R*!WAQw2#$L-CeMuMZ#jz!5~P z+?QAF{@{@N#XM90LA86$^h55|gN7ffn(9v%QOJ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CPI{D&OJd8)DICpka*KPrzU4*&oF diff --git a/windows-snapshot-tool/src/main.cpp b/windows-snapshot-tool/src/main.cpp index 4add802..22a60cc 100644 --- a/windows-snapshot-tool/src/main.cpp +++ b/windows-snapshot-tool/src/main.cpp @@ -347,19 +347,22 @@ int CaptureImage(HWND hWnd, const wchar_t* filename) { int width = GetDeviceCaps(hdcScreen, HORZRES); int height = GetDeviceCaps(hdcScreen, VERTRES); + HBITMAP hBmp = CreateCompatibleBitmap(hdcScreen, width, height); + // Select the compatible bitmap into the compatible memory DC. - SelectObject(hdcMemDC,hbmScreen); + SelectObject(hdcMemDC,hBmp); // Bit block transfer into our compatible memory DC. if(!BitBlt(hdcMemDC, - 0,0, - rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, - hdcWindow, + 0,0, + width, height, + hdcScreen, 0,0, SRCCOPY)) { MessageBox(hWnd, L"BitBlt has failed", L"Failed", MB_OK); DeleteObject(hbmScreen); + DeleteObject(hBmp); DeleteObject(hdcMemDC); ReleaseDC(NULL,hdcScreen); ReleaseDC(hWnd,hdcWindow); @@ -367,7 +370,7 @@ int CaptureImage(HWND hWnd, const wchar_t* filename) { } // Get the BITMAP from the HBITMAP - GetObject(hbmScreen,sizeof(BITMAP),&bmpScreen); + GetObject(hBmp,sizeof(BITMAP),&bmpScreen); BITMAPFILEHEADER bmfHeader; BITMAPINFOHEADER bi; @@ -394,7 +397,7 @@ int CaptureImage(HWND hWnd, const wchar_t* filename) { // Gets the "bits" from the bitmap and copies them into a buffer // which is pointed to by lpbitmap. - GetDIBits(hdcWindow, hbmScreen, 0, + GetDIBits(hdcScreen, hBmp, 0, (UINT)bmpScreen.bmHeight, lpbitmap, (BITMAPINFO *)&bi, DIB_RGB_COLORS); @@ -433,6 +436,7 @@ int CaptureImage(HWND hWnd, const wchar_t* filename) { // clean up DeleteObject(hbmScreen); + DeleteObject(hBmp); DeleteObject(hdcMemDC); ReleaseDC(NULL,hdcScreen); ReleaseDC(hWnd,hdcWindow);