?
Solved

Converting EMF to Bitmap

Posted on 2006-10-19
7
Medium Priority
?
394 Views
Last Modified: 2010-08-05
I need to enable drag and drop of pictures from Excel into my VB6 form.  When you drag an image out of Excel, it has no bitmap in it's data object, just a metafile and enhanced metafile.

I need to extract the bitmap from the metafile so I can save it as a jpeg.

The solutions I've found so far either save it as a metafile with a .bmp extension, or screw up the color depth.  The hack I'm using right now is to open it in MS Paint and re-save the file as a bitmap, but I need a way to do this within code (without opening extra windows, etc).  If I use PlayEnhMetaFile into any kind of IPicture or StdPicture, it remains as a metafile.

How can I extract/convert the EMF to a Bitmap?
0
Comment
Question by:djsansui
[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
7 Comments
 
LVL 28

Expert Comment

by:Ark
ID: 17770514
Picture1.AutoSize=True
Picture1.AutoRedraw=True
Picture1.Picture = LoadPicture("c:\test.emf")
SavePicture Picture1.Image, "c:\test.bmp"
0
 
LVL 15

Expert Comment

by:JackOfPH
ID: 17771078
try this you may have an idea here ...
http://vbaccelerator.com/codelib/gfx/vbjpeg.htm
0
 
LVL 2

Author Comment

by:djsansui
ID: 17775353
Ark,

Thanks, that almost works... it does save the image as a proper bitmap file, but for whatever reason, the picbox control stretches the image a bit and messes up the colors.

Any ideas?
0
 
LVL 28

Accepted Solution

by:
Ark earned 2000 total points
ID: 17777936
Try PlayEnhMetaFile into Picture1.hDc and then SavePicture Picture1.Image, "c:\test.bmp"
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month11 days, 11 hours left to enroll

752 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