Print from clipboard/print bitmap
-
hi all, I have an image saved into clipboard, it is possible to print it? how? If I save the file how to print it? tks!
Here is a small example that plots a metafile from the clipboard into a DC. This would work with a display DC or a printer DC:
CRect metafile(0, 0, 100, 100);
if (IsClipboardFormatAvailable(CF_METAFILEPICT))
{
// play a metafile from the clipboard if available
GLOBALHANDLE hGMem ;
LPMETAFILEPICT lpMFP ;
OpenClipboard() ;
hGMem = GetClipboardData(CF_METAFILEPICT) ;
lpMFP = (LPMETAFILEPICT)GlobalLock(hGMem) ;
pDC->SaveDC() ;
pDC->SetMapMode(lpMFP->mm) ;
pDC->SetViewportExt(metafile.Width(), metafile.Height()) ;
pDC->SetViewportOrg(metafile.left, metafile.top) ;
pDC->PlayMetaFile(lpMFP->hMF) ;
VERIFY(pDC->RestoreDC(-1)) ;
GlobalUnlock(hGMem) ;
CloseClipboard() ;
}Roger Allen Sonork 100.10016 In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!