[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Metafile converter

Posted on 2002-05-28
3
Medium Priority
?
781 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 280 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

656 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