Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. CreateMetaFile on Win7 64bit

CreateMetaFile on Win7 64bit

Scheduled Pinned Locked Moved Windows API
graphicsperformancehelpquestion
3 Posts 2 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Carsten Leue
    wrote on last edited by
    #1

    I have test code that embeds a bitmap in a WMF metafile and creates a memory DC for that purpose. The code works fine on XP but fails on Windows7 64bit. The minimum sniplet to recreate the problem is:

    HDC hDC = ::CreateMetaFile(\_T("test.wmf"));
    HDC memDC = ::CreateCompatibleDC(hDC);
    \_ASSERTE(memDC != NULL);
    
    ::DeleteDC(memDC);
    
    HMETAFILE hMeta = ::CloseMetaFile(hDC);
    
    ::DeleteMetaFile(hMeta);
    

    CreateCompatibleDC fails and GetLastError returns 183. Is the creation of WMF files no longer supported on Windows7? The corresponding CreateEnhMetaFile method works fine. Thanks Carsten

    D 1 Reply Last reply
    0
    • C Carsten Leue

      I have test code that embeds a bitmap in a WMF metafile and creates a memory DC for that purpose. The code works fine on XP but fails on Windows7 64bit. The minimum sniplet to recreate the problem is:

      HDC hDC = ::CreateMetaFile(\_T("test.wmf"));
      HDC memDC = ::CreateCompatibleDC(hDC);
      \_ASSERTE(memDC != NULL);
      
      ::DeleteDC(memDC);
      
      HMETAFILE hMeta = ::CloseMetaFile(hDC);
      
      ::DeleteMetaFile(hMeta);
      

      CreateCompatibleDC fails and GetLastError returns 183. Is the creation of WMF files no longer supported on Windows7? The corresponding CreateEnhMetaFile method works fine. Thanks Carsten

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Error 183 means "File already exists". If I remember correctly, CreateMetaFile was still around only for backwards compatibility with older Windows Metafiles. I think it was replaced by CreateEnhMetaFile some time ago.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      C 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Error 183 means "File already exists". If I remember correctly, CreateMetaFile was still around only for backwards compatibility with older Windows Metafiles. I think it was replaced by CreateEnhMetaFile some time ago.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        C Offline
        C Offline
        Carsten Leue
        wrote on last edited by
        #3

        Hi Dave, but why would "CreateCompatibleDC" return "File already exists"? The method "CreateMetaFile", that actually creates the file, completes successfully. I understand that CreateEnhMetaFile exists, but need to be able to create WMF file legacy reasons. Regards Carsten

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups