Re: How to print a graph/document using Metafile ?
Thanks Joseph
I have modified the code as given below, now it works fine !
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (UpdateData(TRUE))
{
DOCINFO di;
if (DC)
{
ZeroMemory( &di, sizeof(DOCINFO));
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = "WQS Graph";
if (SP_ERROR != :tartDoc(DC, &di))
{
:tartPage(DC);
if (IsClipboardFormatAvailable(CF_METAFILEPICT))
{
GLOBALHANDLE hGMem ;
LPMETAFILEPICT lpMFP ;
OpenClipboard() ;
hGMem = GetClipboardData(CF_METAFILEPICT) ;
lpMFP = (LPMETAFILEPICT)GlobalLock(hGMem) ;
DC.SaveDC() ;
DC.SetMapMode(lpMFP->mm) ;
DC.SetWindowOrg( 0,0);
DC.SetWindowExt( (int) dXExt, (int)dYExt );
DC.SetViewportOrg( 0, (int)(dYPixsInch/2.0) );
DC.SetViewportExt((int)dXExt, (int)dYExt) ;
DC.PlayMetaFile(lpMFP->hMF) ;
VERIFY(DC.RestoreDC(-1)) ;
GlobalUnlock(hGMem) ;
CloseClipboard() ;
}
::EndPage(DC);
::EndDoc(DC);
}
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////