home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
- Begin VB.Form frmAnalyze
- Caption = "Analyze Metafile"
- ClientHeight = 3180
- ClientLeft = 1095
- ClientTop = 1515
- ClientWidth = 5160
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 3180
- ScaleWidth = 5160
- Begin VB.CheckBox chkSingle
- Caption = "Single Step"
- Height = 255
- Left = 3660
- TabIndex = 3
- Top = 2220
- Width = 1395
- End
- Begin VB.PictureBox Picture1
- Height = 1275
- Left = 3660
- ScaleHeight = 83
- ScaleMode = 3 'Pixel
- ScaleWidth = 91
- TabIndex = 2
- Top = 840
- Width = 1395
- End
- Begin VB.CommandButton cmdAnalyze
- Caption = "Analyze"
- Height = 495
- Left = 3660
- TabIndex = 1
- Top = 180
- Width = 1395
- End
- Begin VB.ListBox List1
- Height = 2760
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 3375
- End
- Begin MSComDlg.CommonDialog CMDialogMF
- Left = 3660
- Top = 2580
- _ExtentX = 847
- _ExtentY = 847
- _Version = 327680
- Filter = "Metafiles (*.wmf)|*.wmf"
- Flags = 4100
- FontSize = 2.54016e-29
- End
- Attribute VB_Name = "frmAnalyze"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' Analyze.vbp
- ' Copyright (c) 1995-1997 by Desaware Inc. All Rights Reserved
- Option Explicit
- ' Set by frmPrompt to include or discard a record
- Public IncludeRecord%
- Private Sub cmdAnalyze_Click()
- Dim usefile$
- #If Win32 Then
- Dim saved&
- Dim dc&
- Dim usemf&
- Dim di&, dl&
- #Else
- Dim saved%
- Dim dc%
- Dim usemf%
- Dim di%, dl&
- #End If
- Dim oldsize As SIZE
- IncludeRecord = True ' Initialize value
- List1.Clear ' Clear list box
- CMDialogMF.DialogTitle = "Load a metafile"
- CMDialogMF.Action = 1
- usefile$ = CMDialogMF.FileName
- If usefile$ <> "" Then
- usemf = LoadTheMetafile(usefile$)
- If usemf <> 0 Then
- ' Now draw the metafile
- Picture1.Cls
- dc = Picture1.hDC
- saved = SaveDC(dc)
- ' Now set the new coordinate system. See the CmdExecute()_Click
- ' command for further explanation
- ' Most metafiles will set their own extents, but we need
- ' to set the viewport to match the scalemode of the
- ' entire screen to fill the window
- di = SetMapMode(dc, MM_ANISOTROPIC)
- dl = SetViewportExtEx(dc, Picture1.ScaleWidth, Picture1.ScaleHeight, oldsize)
- ' All of the drawing objects that were used on the original
- ' objects were saved with the metafile, thus the metafile
- ' will automatically draw each object in the correct color
- ' and style.
- di = EnumMetaFile(dc, usemf, AddressOf Callback1_EnumMetaFile, 0)
- ' di = PlayMetaFile(dc, usemf)
- ' And restore the original DC state
- di = RestoreDC(dc, saved)
- di = DeleteMetaFile(usemf)
- End If
- End If
- End Sub
- Public Function GetFunctionName$(fnum As Integer)
- Select Case fnum
- Case &H817: GetFunctionName = "Arc"
- Case &H830: GetFunctionName = "Chord"
- Case &H418: GetFunctionName = "Ellipse"
- Case &H415: GetFunctionName = "ExcludeClipRect"
- Case &H419: GetFunctionName = "FloodFill"
- Case &H416: GetFunctionName = "IntersectClipRect"
- Case &H213: GetFunctionName = "LineTo"
- Case &H214: GetFunctionName = "MoveTo"
- Case &H220: GetFunctionName = "OffsetClipRgn"
- Case &H211: GetFunctionName = "OffsetViewportOrg"
- Case &H20F: GetFunctionName = "OffsetWindowOrg"
- Case &H211: GetFunctionName = "OffsetViewportOrg"
- Case &H61D: GetFunctionName = "PatBlt"
- Case &H81A: GetFunctionName = "Pie"
- Case &H35: GetFunctionName = "RealizePalette"
- Case &H41B: GetFunctionName = "Rectangle"
- Case &H139: GetFunctionName = "ResizePalette"
- Case &H127: GetFunctionName = "RestoreDC"
- Case &H61C: GetFunctionName = "RoundRect"
- Case &H1E: GetFunctionName = "SaveDC"
- Case &H412: GetFunctionName = "ScaleViewportExt"
- Case &H400: GetFunctionName = "ScaleWindowExt"
- Case &H61C: GetFunctionName = "RoundRect"
- Case &H201: GetFunctionName = "SetBkColor"
- Case &H102: GetFunctionName = "SetBkMode"
- Case &H103: GetFunctionName = "SetMapMode"
- Case &H231: GetFunctionName = "SetMapperFlags"
- Case &H41F: GetFunctionName = "SetPixel"
- Case &H106: GetFunctionName = "SetPolyFillMode"
- Case &H104: GetFunctionName = "SetROP2"
- Case &H107: GetFunctionName = "SetStretchBltMode"
- Case &H12E: GetFunctionName = "SetTextAlign"
- Case &H108: GetFunctionName = "SetTextCharExtra"
- Case &H209: GetFunctionName = "SetTextColor"
- Case &H20A: GetFunctionName = "SetTextJustification"
- Case &H20E: GetFunctionName = "SetViewportExt"
- Case &H20D: GetFunctionName = "SetViewportOrg"
- Case &H20C: GetFunctionName = "SetWindowExt"
- Case &H20B: GetFunctionName = "SetWindowOrg"
- Case &H2FC: GetFunctionName = "CreateBrushIndirect"
- Case &H2FB: GetFunctionName = "CreateFontIndirect"
- Case &HF7: GetFunctionName = "CreatePalette"
- Case &H922: GetFunctionName = "BitBlt (DDB)"
- Case &H940: GetFunctionName = "BitBlt (DIB)"
- Case &H1F9: GetFunctionName = "CreateBrushIndirect (DDB)"
- Case &H142: GetFunctionName = "CreateBrushIndirect (DIB)"
- Case &H2FA: GetFunctionName = "CreatePenIndirect"
- Case &H6FF: GetFunctionName = "CreateRegion"
- Case &H1F0: GetFunctionName = "DeleteObject"
- Case &H626: GetFunctionName = "Escape"
- Case &HA32: GetFunctionName = "ExtTextOut"
- Case &H324: GetFunctionName = "Polygon"
- Case &H538: GetFunctionName = "PolyPolygon"
- Case &H325: GetFunctionName = "Polyline"
- Case &H12C: GetFunctionName = "SelectClipRgn"
- Case &H12D: GetFunctionName = "SelectObject"
- Case &H234: GetFunctionName = "SelectPalette"
- Case &HD33: GetFunctionName = "SetDIBitsToDevice"
- Case &H37: GetFunctionName = "SetPaletteEntries"
- Case &HB23: GetFunctionName = "StretchBlt (DDB)"
- Case &HB41: GetFunctionName = "StretchBlt (DIB)"
- Case &HF43: GetFunctionName = "StretchDIBits"
- Case &H521: GetFunctionName = "TextOut"
- End Select
- End Function
- Public Function GetObjDescription$(objnum)
- Select Case objnum
- Case OBJ_PEN: GetObjDescription$ = "Pen"
- Case OBJ_BRUSH: GetObjDescription$ = "Brush"
- Case OBJ_DC: GetObjDescription$ = "Device Context"
- Case OBJ_METADC: GetObjDescription$ = "Metafile Device Context"
- Case OBJ_PAL: GetObjDescription$ = "Palette"
- Case OBJ_FONT: GetObjDescription$ = "Font"
- Case OBJ_BITMAP: GetObjDescription$ = "Bitmap"
- Case OBJ_REGION: GetObjDescription$ = "Region"
- Case OBJ_METAFILE: GetObjDescription$ = "Metafile"
- Case OBJ_MEMDC: GetObjDescription$ = "Memory device context"
- Case OBJ_EXTPEN: GetObjDescription$ = "Extended Pen"
- Case OBJ_ENHMETAFILE: GetObjDescription$ = "Enhanced metafile"
- End Select
- End Function
-