Results 1 to 5 of 5

Thread: how to show emf+ by vb6?check emf/emf+ format?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,141

    how to show emf+ by vb6?check emf/emf+ format?

    how to show emf+ by vb6?check emf/emf+ format?
    how to create emf+ by vb6?

    [RESOLVED] [GDI+] EMF > WMF & VB6 LoadPicture-VBForums
    https://www.vbforums.com/showthread....B6-LoadPicture

    PNG transparency weird: GDI+ Draw into Meta DC-VBForums
    https://www.vbforums.com/showthread....ypeEmfPlusDual

    SHOW BY -mspaint.exe-AND VB6 GDI32 PlayEnhMetaFile
    Name:  EMF-mspaint.exe-VB6 GDI32.jpg
Views: 414
Size:  23.9 KB
    Last edited by xiaoyao; Jun 12th, 2025 at 09:30 PM.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,141

    Re: how to show emf+ by vb6?check emf/emf+ format?

    Code:
    'EMFs can be moved between various formats.  GDI+ prefers "EMF+", which supports GDI primitives as well as newer GDI+ commands
    Private Enum MetafileType
       MetafileTypeInvalid            'Invalid metafile
       MetafileTypeWmf                'Standard WMF
       MetafileTypeWmfPlaceable       'Placeable WMF
       MetafileTypeEmf                'Plain EMF (not EMF+)
       MetafileTypeEmfPlusOnly        'EMF+ without dual down-level records
       MetafileTypeEmfPlusDual        'EMF+ with dual down-level records
    End Enum
    
    Private Enum EMFType
        EmfTypeEmfOnly = MetafileTypeEmf               'Only the old GDI EMF format
        EmfTypeEmfPlusOnly = MetafileTypeEmfPlusOnly   'Only the new GDI+ EMF+ format
        EmfTypeEmfPlusDual = MetafileTypeEmfPlusDual   'Store duplicate commands, in both EMF and EMF+ format
    End Enum
    
    Private Declare Function GdipConvertToEmfPlus Lib "gdiplus" (ByVal refGraphics As Long, ByVal oldMetafilePtr As Long, ByRef conversionSuccess As Long, ByVal typeOfEMF As EMFType, ByVal descriptionPointer As Long, ByRef newMetafilePtr As Long) As Long
    A couple notes...

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,141

    Re: how to show emf+ by vb6?check emf/emf+ format?

    Quote Originally Posted by Jonney View Post
    Rather using old GDI EMF, why not use GDI+ GdipRecordMetafile? I will consider this technique.

    Code:
        Dim rctF As RECTF, metafile As Long,hGraphics As Long,Meta_DC As Long
        rctF.Width = paperWidthInMillimeter: rctF.Height = paperHeightInMillimeter
        Dim lR As Long
        lR = GdipRecordMetafile(Printer.hdc, EmfTypeEmfPlusOnly, rctF, MetafileFrameUnitMillimeter, StrPtr("EMFPlus"), metafile) 'or hdc = CreateCompatibleDC(0)
        If lR= 0 Then
           GdipGetImageGraphicsContext metafile, hGraphics
           GdipGetDC hGraphics, Meta_DC
        End If
    Edited:
    I draw something on the Meta_DC, seemed nothing showing. Don't know why.
    GdipGetHemfFromMetafile metafile,hEmf also doesn't work.

    OK, I will open another new thread regarding GdipRecordMetafile. But if you like to post something below,go ahead. I will keep follow-up. Thanks.


    Quote Originally Posted by DrUnicode View Post
    You will need vbRichClient5.dll and vbWidgets.dll installed to run this demo.
    Download at http://vbrichclient.com/#/en/Downloads.htm
    how to create emf+ file?

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,141

    Re: how to show emf+ by vb6?check emf/emf+ format?

    [RESOLVED] How to make GdipRecordMetafile sets of API work?-VBForums
    https://www.vbforums.com/showthread....RecordMetafile

    This can create an EMF+file, but it requires specifying a new EMF file path from the beginning, then drawing, and finally displaying it on picture1.hdc.
    GdipDeleteGraphics hMetaGraphics

    It is impossible to update and display the image in real-time every time it is drawn.
    Like rectangles, circles, and triangles, they are displayed once every time.
    It would be even better to not specify a file name at the beginning and save it in EMF+format after drawing.
    Last edited by xiaoyao; Jun 13th, 2025 at 08:38 AM.

  5. #5
    Fanatic Member
    Join Date
    Jun 2016
    Location
    EspaƱa
    Posts
    603

    Re: how to show emf+ by vb6?check emf/emf+ format?

    try this https://binaryworld.net/Main/CodeDet...deId=3798#copy

    the link contains more sub links
    Last edited by yokesee; Jun 16th, 2025 at 04:01 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width