🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #1584

Metafiles and VB 1.0

#1584
From: Balam Willemsen
Date: Tue, 13 Oct 1992 20:33
44 lines
2201 bytes
Hi all Windows programming gurus,

How can I go about creating metafiles (.WMF) using VB (w/Pro tools)?
[if need be I also have TPW 1.0]

I kow that I need to make calls to GDI directly, but there must be
someting I'm missing. My code looks someting like...

Createmetafile 

SetWindowOrg
SetWindowExt

CreatePenIndirect
MoveTo
LineTo
... repeat ...

CloseMetafile
PlayMetafile (to a Form's hDC)
CopyMetafile

I get the almost the desired effect, in that the picture copied to the
form looks right, and the .WMF copied to disk can be LoadPicture'd.
Yet... Nobody else likes the .WMF. None of the drawing tools that
support .WMF will import it (WFW 2.0, Ami Pro 2.0, Micrografix Draw 3.0)
although Ami Pro 2.0 will Import Picture it, which I can then copy to
the clipboard and get a proper .WMF.

The other problem I have is that the logical units of the do not seem to
make sense. I tried changing them with SetMapMode after I CreatMetafile,
but for any mode other than zero the PlayMetafile gives me a multi-   
colored bitmap. <sigh>

This should really not be a problem unique to VB since the code just
makes a whole bunch of GDI calls. None of the books that I have seen on
Windows programming ever seems to go into detail on how to create
"standard" Metafiles that can be read into the major Win Apps.

If anyone cares, I am porting some QB code that draws contour plots, and
I'd love to save my plots as .WMF for better presentation than a .BMP.

Balam A. Willemsen
Graduate Student, Dept. of Physics, Northeastern Univ., Boston, MA 02115, USA
Technical Details
Message-ID: <1992Oct13.203347.3512@lynx.dac.northeastern.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!kithrup!hoptoad!pacbell.com!sgiblab!swrinde!cs.utexas.edu!sun-barr!olivea!news.bbn.com!noc.near.net!lynx!bwillems

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!kithrup!hoptoad!pacbell.com!sgiblab!swrinde!cs.utexas.edu!sun-barr!olivea!news.bbn.com!noc.near.net!lynx!bwillems
From: bwillems@lynx.dac.northeastern.edu (Balam Willemsen)
Newsgroups: comp.os.ms-windows.programmer.misc,alt.lang.basic
Subject: Metafiles and VB 1.0
Summary: How to create PROPER metafiles with VB
Keywords: Windows metafile, .WMF, Visual BASIC, VB
Message-ID: <1992Oct13.203347.3512@lynx.dac.northeastern.edu>
Date: 13 Oct 92 20:33:47 GMT
Followup-To: comp.os.ms-windows.programmer.misc
Organization: Northeastern University, Boston, MA. 02115, USA
Lines: 44