/***************************************************************************\
* xxxSnapWindow
*
* Effects: Snaps either the desktop hwnd or the active front most window. If
* any other window is specified, we will snap it but it will be clipped.
*
\***************************************************************************/
BOOL xxxSnapWindow(
PWND pwnd)
{
/*
* Open the clipboard and empty it.
*
* pwndDesktop is made the owner of the clipboard, instead of the
* currently active window; -- SANKAR -- 20th July, 1989 --
*/
fSuccess = xxxOpenClipboard(pwndT, NULL);
xxxEmptyClipboard(pwinsta);
。。。。。。。。
。。。。。
hdcScr = _GetWindowDC(pwnd);
if (!hdcScr)
goto MemoryError;
hdcMem = GreCreateCompatibleDC(hdcScr);
if (SYSMET(SAMEDISPLAYFORMAT)) {
hbm = GreCreateCompatibleBitmap(hdcScr, rc.right, rc.bottom);
} else {
hbm = GreCreateBitmap(rc.right, rc.bottom, 1, gpDispInfo->BitCountMax, NULL);
}
if (!hbm) {
hbm = GreCreateBitmap(rc.right, rc.bottom, 1, 1, NULL);
if (!hbm)
goto MemoryError;
}
hbmOld = GreSelectBitmap(hdcMem, hbm);
fRet = GreBitBlt(hdcMem, 0, 0, rc.right, rc.bottom, hdcScr, rc.left, rc.top, SRCCOPY | CAPTUREBLT, 0);
GreSelectBitmap(hdcMem, hbmOld);
_SetClipboardData(CF_BITMAP, hbm, FALSE, TRUE);
PlayEventSound(USER_SOUND_SNAPSHOT);
fRet = TRUE;
SnapExit:
。。。。。。。。
/*
* Release the window/client DC.
*/
if (hdcScr) {
_ReleaseDC(hdcScr);
}
xxxCloseClipboard(pwinsta);
。。。。。。
goto SnapExit;
}