瀏覽代碼

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

Jeff 2 年之前
父節點
當前提交
cc84bfa1c2
共有 1 個文件被更改,包括 5 次插入3 次删除
  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;
 		}