Resources

MFC Visual C++

Return to Top


How to save WMF from Clipboard.

CFileDialog thedlg(FALSE,"wmf");
thedlg.m_ofn.lpstrTitle="Save As WMF";
if( thedlg.DoModal()!=IDOK ){
	return;
} 

CString filename(thedlg.GetPathName());
if( OpenClipboard() ){
	HENHMETAFILE thehandle=(HENHMETAFILE)::GetClipboardData(CF_ENHMETAFILE);
	if( thehandle!=NULL ){
		::remove(filename);
		HENHMETAFILE hmeta=CopyEnhMetaFile(thehandle,filename);
		::CloseEnhMetaFile(NULL);
	}
	::CloseClipboard();
}

Download application (zip archived)
SaveAsWMF.zip

Download Visual C++6.0 project (zip archived)
SaveWMFviaClipVC.zip