Browse Source

PrintWindow函数指定复制窗口的客户区域。

Jeff 2 năm trước cách đây
mục cha
commit
cc84bfa1c2
1 tập tin đã thay đổi với 5 bổ sung3 xóa
  1. 5 3
      GameAssist/GameAssist/ImgAssist.cpp

+ 5 - 3
GameAssist/GameAssist/ImgAssist.cpp

@@ -106,15 +106,17 @@ namespace ImgAssist
 		RECT rc,rcc;
 		::GetWindowRect(hWnd, &rc);
 		::GetClientRect(hWnd, &rcc);
-		int width = rc.right - rc.left;
-		int height = rc.bottom - rc.top;
+		int width = rcc.right - rcc.left;
+		int height = rcc.bottom - rcc.top;
+		int dx = rc.right - rc.left - width;
+		int dy = rc.bottom - rc.top - height;
 		// 创建兼容位图;
 		hbmpWindow = ::CreateCompatibleBitmap(hdcWindow, width, height);
 		// 将位图选入兼容DC;
 		SelectObject(hdcMemDC, hbmpWindow);
 #if 1
 		// 将窗口复制到兼容DC中(当窗口被遮挡时,这个函数效果好)
-		if(!::PrintWindow(hWnd, hdcMemDC, 0))
+		if(!::PrintWindow(hWnd, hdcMemDC, PW_CLIENTONLY))
 		{
 			goto done;
 		}