|
-
April 6th, 2005, 06:07 AM
#1
WMF to CLIPBOARD
Hello, i'm having a problem trying to copy a WMF file to the windows clipboard, and i want to ask you if there is any function wich allows to do it directly. Because i've tried to do it from a metafile structure, but it doesn't goes, cause when i use the SetClipboardData function, the image which appears in the clipboard is the left-up corner of the image, and i don't understand it.
Thank you for read my messagge, and i hope your help.
-
April 7th, 2005, 05:26 AM
#2
Re: WMF to CLIPBOARD
Theorically SetClipboardData, must be called with a handle to a metafile (and not a HGLOBAL containing a metafile structure).
I have not tested it, but it can look like that:
Code:
BOOL CopyEnhMetafileToClipboard(HWND hWndOwner,LPCTSTR pszFileName)
{
if (!OpenClipboard(hWndOwner)) return FALSE;
HENHMETAFILE hmf=GetEnhMetafile(pszFileName);
if (hmf==NULL) {CloseClipboard();return FALSE;}
if (!EmptyClipboard()) {CloseClipboard();DeleteEnhMetafile(hmf);return FALSE;}
BOOL r=SetClipboardData(CF_ENHMETAFILE,hmf)!=NULL;
CloseClipboard();
return r;
}
I hope, this will work correctly.
-
April 7th, 2005, 12:15 PM
#3
Re: WMF to CLIPBOARD
Thankyou SuperKoko, but the problem is thah what i have is a wmf file. From an emf file with a code like what you have wrote before, it could be possible, but what i really need now is to know if there is a c++ function to transform my wmf file to an emf file, cause i've tested that using a program(not c++) which converts my wmf in emf, i can move it to the clipboard from the emf file.
Thankyou.
-
April 8th, 2005, 12:12 AM
#4
Re: WMF to CLIPBOARD
Hi,
I remember I have found this kind of code before,I think you need use google to search this kind of article.
Regards
Andy
-------------------------------------------------------------------------
XD++ MFC Library V9.0 -- http://www.********.net
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|