home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "basMAIN"
- Option Explicit
- ' MetaGif converts Windows Metafiles to CompuServe Gif files. This
- ' 32 bit DLL allows image resizeing without distortion. With this
- ' library you can create WEB documents on the fly, from your Windows
- ' application. With MetaGif you can create a Gif file that is larger
- ' than the screen.
- '
- ' The main() program is a simple example of how to use MetaGif. The program
- ' will convert the two Windows (placeable) Metafiles to CompuServe Gif
- ' files. You can use Microsoft Word to view the metafiles and the gif file
- ' results.
- '
- ' See the MetaGif function declaration for a full description of usage. MetaGif
- ' is a Shareware program, see the readme.txt file for registration
- ' information.
- '
- ' THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS
- ' OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE
- ' IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- ' PARTICULAR PURPOSE.
- '
- ' Author:
- ' David E. Suffield
- ' Eckler Software
- ' 620 101st Court
- ' Vancouver, WA 98664
- ' dsuffiel@worldaccess.com
- '
- Declare Function LoadLibrary Lib "Kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
- Declare Function FreeLibrary Lib "Kernel32" (ByVal hLibModule As Long) As Long
-
- ' Function: MetaGif()
- '
- ' Purpose: Convert Placeable Metafiles to Gif files.
- '
- ' Parameters:
- ' szWmf placeable metafile file name (input)
- ' szGif gif file name (output)
- ' scaleX scale factor percentage (100 = width*1)
- ' scaleY scale factor percentage (150 = height*1.5)
- '
- ' Returns:
- ' -3 could not open placeable metafile
- ' -2 could not write gif file
- ' -1 not a placeable metafile
- ' 0 not enough memory
- ' 1 ok
- '
- ' History:
- ' 1.00 Converted from 16 bit MetaGif.
- '
- ' 2.00 Rewritten for 32 bit WIN95/NT OS. Up to 32 times faster than
- ' MetaGif 1.00. MetaGif 2.00 supports the following display modes -
- ' 1, 4, 8, 16 and 24 color bits per pixel. This corresponds to
- ' monochrome, 16, 256, 32k and 16meg color displays. MetaGif memory
- ' usage depends on the size of your gif file in pixels and your default
- ' color display settings. A 24 bit color display would use 3 times
- ' more memory than a 8 bit color display.
- '
- Declare Function MetaGif Lib "metagif32.dll" (ByVal szWmf As String, ByVal szGif As String, ByVal scaleX As Integer, ByVal scaleY As Integer) As Long
-
- Global stopit As Integer
-
- Sub main()
- Dim r As Integer, i As Integer, hInst As Long
- Dim exePath As String
- Dim t1 As Long, t2 As Long
-
- t1 = Timer
- Screen.MousePointer = 11 ' Change pointer to hourglass.
-
- frmTest.txtMax = 10
- frmTest.txtCnt = 0
- frmTest.Show
- frmTest.Refresh
-
- If (Right$(App.Path, 1) <> "\") Then
- exePath = App.Path + "\"
- Else
- exePath = App.Path 'probably app.path="A:\"
- End If
-
- stopit = False
-
- For i = 1 To frmTest.txtMax
- 'Convert metafile to gif file, output is 50% bigger.
- r = MetaGif(exePath + "anchor.wmf", exePath + "anchor.gif", 150, 150)
- If (r <> 1) Then
- MsgBox ("MetaGif() return: " + Format$(r))
- End If
-
- 'Convert metafile to gif file, output is 50% smaller.
- r = MetaGif(exePath + "coins.wmf", exePath + "coins.gif", 50, 50)
- If (r <> 1) Then
- MsgBox ("MetaGif() return: " + Format$(r))
- End If
-
- frmTest.txtCnt = i
- r = DoEvents()
- If (stopit) Then Exit For
- Next
-
- Unload frmTest
- Screen.MousePointer = 0
- t2 = Timer - t1
- MsgBox ("time in seconds: " + Format$(t2))
-
- End Sub
-
-