` Printed Icetips Article

Icetips Article



Windows API: Getting handle of Clarion style metafiles - structure
2003-04-28 -- Ron Schofield
 
Newsgroups: comp.lang.clarion


typedef struct _PlaceableMetaHeader
{
  DWORD Key;           /* Magic number (always 9AC6CDD7h) */
  WORD  Handle;        /* Metafile HANDLE number (always 0) */
  SHORT Left;          /* Left coordinate in metafile units */
  SHORT Top;           /* Top coordinate in metafile units */
  SHORT Right;         /* Right coordinate in metafile units */
  SHORT Bottom;        /* Bottom coordinate in metafile units */
  WORD  Inch;          /* Number of metafile units per inch */
  DWORD Reserved;      /* Reserved (always 0) */
  WORD  Checksum;      /* Checksum value for previous 10 WORDs */
} PLACEABLEMETAHEADER;

From  http://www.wotsit.org/download.asp?f=wmf

"Steve Johnson - ThinkData Inc." wrote:

> That's what I was afraid of   Do you happen to have the definition for
> the AldusHeader structure?
>
> Thanks
>
> Steve
>
> "Leonid Chudakov"  wrote in message
> news:3ead9af0@news.softvelocity.com...
> > I'm using temporary files.
> >
> >    !Check if it's Aldus style file
> >    hFile = _lopen(ClarionMetafileName,2)
> >    RetVal = _lread(hFile,Address(AldusHeader),22)
> >    If AldusHeader.Key = 9AC6CDD7H Then !Aldus style file
> >      !Create work wmf file
> >      RetVal = GetTempPath(255,TempPath)
> >      RetVal = GetTempFileName(TempPath,FilePrefix,0,TempFileName)
> >      hTempFile = _lopen(TempFileName,2)
> >      mfglbhnd = GlobalAlloc(BOR(GMEM_MOVEABLE,GMEM_ZEROINIT),
> > GetFileSize(hFile,0) - 22)
> >      gptr = GlobalLock(mfglbhnd)
> >      RetVal = _llseek(hFile,22,0)
> >      RetVal = _hread(hFile, gptr, GetFileSize(hFile,0) - 22)
> >      RetVal = _hwrite(hTempFile, gptr, GetFileSize(hFile,0) - 22)
> >      RetVal = GlobalFree(mfglbhnd)
> >      RetVal = _lclose(hTempFile)
> >      hMeta = GetMetafile(TempFileName)
> >    End
> >
> > "Steve Johnson - ThinkData Inc."  wrote in
> > message news:3ead942b$1@news.softvelocity.com...
> > > How would one skip the first 22 bytes without writing a new temporary
> > file?
> > > Do you have an example of handling this?
> > >
> > > "Leonid Chudakov"  wrote in message
> > > news:3ead9366@news.softvelocity.com...
> > > > Hi Steve,
> > > >
> > > > Clarion generates aldus style wmfs. You need to skip first 22 bytes
> and
> > > use
> > > > GetMetafile.
> > > >
> > > > --
> > > > --
> > > > Leonid Chudakov
> > > > chudakov@netzero.com
> > > > Cool tools and Clarion examples at
> > > > http://www.klarisoft.com
> > > > http://members.tripod.com/cwstuff/clarion_products.htm
> > > >
> > > > "Steve Johnson - ThinkData Inc."  wrote
> in
> > > > message news:3ead8f41$1@news.softvelocity.com...
> > > > > I have tried both GetMetaFile and GetEnhMetaFile - neither one works
> > > > > properly.  Do you have a working example of one of these API
> functions
> > > > > actually functioning with Clarion WMF files?
> > > > >
> > > > > "Sebastian Streiger"  wrote in message
> > > > > news:3ead8e7c@news.softvelocity.com...
> > > > > > Steve:
> > > > > >     There are two "Flavors" of Meta Files.
> > > > > >     Windows Meta Files  - Old windows metafil format
> > > > > >     Enhanced Meta Files - New (win 95 I guess) file format
> > > > > >     Both of this file format usually use the WMF file extension.
> You
> > > > have
> > > > > to
> > > > > > read the file header to know wich one of them you are dealing
> with.
> > > > > >     Clarion Report engine generates EMF.
> > > > > >     You will have to dig in MSDN.
> > > > > > Try this link
> > > > > >
> > > > >
> > > >
> > >
> >
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/metafil
> > > > > > e_0whf.asp
> > > > > >
> > > > > > Probably it won't work, cause MSDN is changes in it's navigation
> > tree
> > > > very
> > > > > > frequently.
> > > > > >
> > > > > > Bets regards
> > > > > >
> > > > > > --
> > > > > > Sebastián Streiger
> > > > > > Departamento Sistemas
> > > > > > Red Megatone
> > > > > > Tel: 0342-4502745
> > > > > > Int: 745
> > > > > > sstreige at redmegatone.com
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > "Steve Johnson - ThinkData Inc." 
> > > escribió
> > > > > en
> > > > > > el mensaje news:3ead8947$1@news.softvelocity.com...
> > > > > > > Hi all -
> > > > > > >
> > > > > > > I'm having issues calling the GetMetaFile API function to
> retrieve
> > a
> > > > WMF
> > > > > > > file and convert it without using Clarion image controls.  I
> have
> > it
> > > > > > > prototyped as follows:
> > > > > > >
> > > > > > > GetMetaFile(*cstring
> > > szMetaFile),long,pascal,raw,name('GetMetaFileA')
> > > > > > >
> > > > > > > No matter what I do, every time I call it and pass it the name
> of
> > a
> > > > > > Clarion
> > > > > > > generated WMF file I get no return value.  Has anyone worked
> with
> > > WMF
> > > > > > files
> > > > > > > in this way?
> > > > > > >
> > > > > > > Thanks
> > > > > > >
> > > > > > > Steve Johnson
> > > > > > > ThinkData Inc.
> > > > > > > http://www.thinkdata.com
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >



Printed November 10, 2024, 1:41 pm
This article has been viewed/printed 35213 times.
Google search has resulted in 112 hits on this article since January 25, 2004.