Click to See Complete Forum and Search --> : Copying Graphics to Word, PowerPoint, etc


Barry Neyer
May 8th, 1999, 02:07 PM
How can I copy the graphical output from my program to various programs. I copied code posted here and got it to work somewhat, but every program seems to treat the object differently. The size comes out differently when I put it into Word than when I put it into PowerPoint.

CMetaFileDC * m_pMetaDC = new CMetaFileDC();

m_pMetaDC->CreateEnhanced(GetDC(), NULL, NULL, "QP");
m_pMetaDC->SetMapMode(MM_HIENGLISH); //how I scale my graphics
OnDraw(m_pMetaDC); //draw meta file

//close meta file dc and prepare for clipboard;
HENHMETAFILE hMF = m_pMetaDC->CloseEnhanced();

//copy to clipboard
OpenClipboard();
EmptyClipboard();
::SetClipboardData(CF_ENHMETAFILE,hMF);
CloseClipboard();
//DeleteMetaFile(hMF);
delete m_pMetaDC;