15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Displaying WMF files

Allan Rentcome -- amurrell@ix.netcom.com
Friday, August 16, 1996

Environment: Windows95, VC++ 4.2

I have an application that I would like to display a WMF file from disk =
in my main CVIEW derived view class. I can generate a memory metafile =
and play it back in the view, but I would like to be able to load a WMF =
file from disk, presumably into a Memory Metafile and 'play' it back =
into the view. Any ideas would be appreciated.

Many Thanks

Allan Rentcome




Kostya Sebov -- sebov@is.kiev.ua
Monday, August 19, 1996

[Mini-digest: 2 responses]

>   Environment: Windows95, VC++ 4.2
>
>   I have an application that I would like to display a WMF file from disk =
>   in my main CVIEW derived view class. I can generate a memory metafile =
>   and play it back in the view, but I would like to be able to load a WMF =
>   file from disk, presumably into a Memory Metafile and 'play' it back =
>   into the view. Any ideas would be appreciated.
>
>   Many Thanks
>
>   Allan Rentcome
>
You're correct in the idea of creating the memory-baset metafile (I hope
you're talking about SetMetafileBits API).

However, note that MOST of the WMF circulating are not exactly Windows
metafiles but so called Aldus placeable metafiles. These are the Windows
metafiles prepended with a small header that contains info on picture's
metrics. This means that to use the WMF file you should first detect the
header (it begins with known signature) and extarct the Windows metafile
portion to be used in SetMetafileBits.

There are some usefull articles in the KB as well as some helpfull samples.
Use "WMF" of "placeable" keywords to search for them.

Hope this'll help.

--- 
Kostya Sebov. 
----------------------------------------------------------------------------
Tel: (38 044) 266-6387 | Fax: (38 044) 266-6195 | E-mail: sebov@is.kiev.ua
-----From: "Dmitry Davidovich" 

 CFile f(name, CFile::modeRead);

 UINT nLoad = (UINT)f.GetLength ();
 BYTE *pMem = new BYTE[nLoad];

 f.Read(pMem, nLoad);
 HMETAFILE hWMF = (HMETAFILE) ::SetMetaFileBitsEx (nLoad, pMem);
+++++++++++++++++++++++++++++++++++++++++
Dmitry Davidovich
CS Tel Aviv University
dmitry@enigma.co.il
ddmitry@libra.math.tau.ac.il
+++++++++++++++++++++++++++++++++++++++++




| Вернуться в корень Архива |