Hi all,
I am trying to copy an entire document in a window, not just the window. I tried the following code:
But this code only copies the active window and the scroll bars. This document is larger than the window. I would like to copy the entire document into the clipboard. How would I do this?
Thank you in advance
I am trying to copy an entire document in a window, not just the window. I tried the following code:
Code:
void CopyWndToClipboard( CWnd *pWnd )
{
CBitmap bitmap;
CClientDC dc(pWnd);
CDC memDC;
CRect rect;
memDC.CreateCompatibleDC(&dc);
pWnd->GetClientRect(rect);
bitmap.CreateCompatibleBitmap(&dc, rect.Width(),rect.Height() );
memDC.s
CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
memDC.BitBlt(-2, -32, rect.Width()-19, rect.Height()-33, &dc, 0, 0, SRCCOPY);
pWnd->OpenClipboard() ;
EmptyClipboard() ;
SetClipboardData (CF_BITMAP, bitmap.GetSafeHandle() ) ;
CloseClipboard () ;
memDC.SelectObject(pOldBitmap);
bitmap.Detach();
}
void CFd4View::OnEditCopy()
{
// CWnd* pWnd = GetOwner() ;
CWnd* pWnd = GetActiveWindow();
// GetClientRect(*pWnd);
CopyWndToClipboard(pWnd);
}
But this code only copies the active window and the scroll bars. This document is larger than the window. I would like to copy the entire document into the clipboard. How would I do this?
Thank you in advance