Author: pborobia
Date: Fri Sep 1 11:25:34 2006
New Revision: 23860
URL:
http://svn.reactos.org/svn/reactos?rev=23860&view=rev
Log:
* Implement ALT+PrintScreen (copy window to clipboard)
Modified:
branches/clipboard/dll/win32/user32/windows/defwnd.c
Modified: branches/clipboard/dll/win32/user32/windows/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/branches/clipboard/dll/win32/user32/wind…
==============================================================================
--- branches/clipboard/dll/win32/user32/windows/defwnd.c (original)
+++ branches/clipboard/dll/win32/user32/windows/defwnd.c Fri Sep 1 11:25:34 2006
@@ -984,7 +984,31 @@
VOID FASTCALL
DefWndScreenshot(HWND hWnd)
{
-
+ RECT rect;
+
+ OpenClipboard(hWnd);
+ EmptyClipboard();
+
+ HDC hdc = GetWindowDC(hWnd);
+ GetWindowRect(hWnd, &rect);
+ INT w = rect.right - rect.left;
+ INT h = rect.bottom - rect.top;
+
+ HBITMAP hbitmap = CreateCompatibleBitmap(hdc, w, h);
+ HDC hdc2 = CreateCompatibleDC(hdc);
+ SelectObject(hdc2, hbitmap);
+
+ BitBlt(hdc2, 0, 0, w, h,
+ hdc, 0, 0,
+ SRCCOPY);
+
+ SetClipboardData(CF_BITMAP, hbitmap);
+
+ ReleaseDC(hWnd, hdc);
+ ReleaseDC(hWnd, hdc2);
+
+ CloseClipboard();
+
}
LRESULT STDCALL
@@ -1347,7 +1371,12 @@
}
else if (wParam == VK_SNAPSHOT)
{
- DefWndScreenshot(hWnd);
+ HWND hwnd = hWnd;
+ while (GetParent(hwnd) != NULL)
+ {
+ hwnd = GetParent(hwnd);
+ }
+ DefWndScreenshot(hwnd);
}
}
else if( wParam == VK_F10 )