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. C / C++ / MFC
  4. Print from clipboard/print bitmap

Print from clipboard/print bitmap

Scheduled Pinned Locked Moved C / C++ / MFC
graphicstutorialquestion
2 Posts 2 Posters 0 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.
  • X Offline
    X Offline
    XAlien
    wrote on last edited by
    #1

    hi all, I have an image saved into clipboard, it is possible to print it? how? If I save the file how to print it? tks!

    R 1 Reply Last reply
    0
    • X XAlien

      hi all, I have an image saved into clipboard, it is possible to print it? how? If I save the file how to print it? tks!

      R Offline
      R Offline
      Roger Allen
      wrote on last edited by
      #2

      Here is a small example that plots a metafile from the clipboard into a DC. This would work with a display DC or a printer DC:

      CRect metafile(0, 0, 100, 100);
      if (IsClipboardFormatAvailable(CF_METAFILEPICT))
      {
      // play a metafile from the clipboard if available
      GLOBALHANDLE hGMem ;
      LPMETAFILEPICT lpMFP ;
      OpenClipboard() ;
      hGMem = GetClipboardData(CF_METAFILEPICT) ;
      lpMFP = (LPMETAFILEPICT)GlobalLock(hGMem) ;
      pDC->SaveDC() ;
      pDC->SetMapMode(lpMFP->mm) ;
      pDC->SetViewportExt(metafile.Width(), metafile.Height()) ;
      pDC->SetViewportOrg(metafile.left, metafile.top) ;
      pDC->PlayMetaFile(lpMFP->hMF) ;
      VERIFY(pDC->RestoreDC(-1)) ;
      GlobalUnlock(hGMem) ;
      CloseClipboard() ;
      }

      Roger Allen Sonork 100.10016 In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!

      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