Solved

Metafile converter

Posted on 2002-05-28
3
743 Views
Last Modified: 2013-11-20
Is it possible to convert from .wmf to emf (Enhanced metafile) ?

Is there a simple function to do the job ?
0
Comment
Question by:win32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 31

Expert Comment

by:Zoppo
ID: 7039189
Hi win32,

this is from MSDN:

------------------------
To convert a Windows-format metafile to an enhanced-format metafile, call the GetMetaFileBitsEx function to retrieve the data from the Windows-format metafile and then call the SetWinMetaFileBits function to convert this data into an enhanced-format metafile.
------------------------

hope this helps,

ZOPPO
0
 

Author Comment

by:win32
ID: 7041497
Yes I know.. but, can't you give me a sample. I am completly lost right now..

This is what I have:
pDC and a wmf file..

I do this:
HMETAFILE hwmf = GetMetaFile(sPath);

// Now I have the hwmf, and need to convert it to emf
HENHMETAFILE = HENHMETAFILE SetWinMetaFileBits(
  UINT cbBuffer,              // size of buffer
  CONST BYTE *lpbBuffer,      // metafile data buffer
  HDC hdcRef,                 // handle to reference DC
  CONST METAFILEPICT *lpmfp   // size of metafile picture
);


And yes.. I have no idea where to get the parameters ??
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 70 total points
ID: 7041532
well, I guess at first you might need to call
GetMetaFileBitsEx like:

UINT iBufSize = GetMetaFileBitsEx(
   hwmf,
   0,
   NULL
);

if ( 0 == iBufSize )
{
   TRACE( "Error (%d) occured\n", GetLastError() );
   return;
}

BYTE pBytes = new BYTE [iBufSize];

GetMetaFileBitsEx(
   hwmf,
   iBufSize,
   (void*)pBytes
);

HENHMETAFILE hNewEmf = SetWinMetaFileBits(
   iBufSize,
   pBytes,
   hDC, // handle to your DC
   NULL // or pointer to a METAFILEPICT structur you filled
)

if ( NULL == hNewEmf )
{
   TRACE( "Error (%d) occured\n", GetLastError() );
   return;
}

ZOPPO
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question