Solved

Metafile converter

Posted on 2002-05-28
3
733 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
dog bark java program 15 121
countEvens challenge 2 115
only14 challenge 19 84
sumHeights2  challenge 7 131
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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