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. Re: bitmap to clipboard, OLE

Re: bitmap to clipboard, OLE

Scheduled Pinned Locked Moved C / C++ / MFC
c++questioncomgraphicshelp
3 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.
  • M Offline
    M Offline
    mla154
    wrote on last edited by
    #1

    I need help. How can I use Visual C++ to copy a bitmap to the clipboard using OLE?

    D 1 Reply Last reply
    0
    • M mla154

      I need help. How can I use Visual C++ to copy a bitmap to the clipboard using OLE?

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

      See the below. Clipboard: Using the OLE Clipboard Mechanism[^] When you call the function to cache the data, you can use the bitmap standard clipboard type documented below. Clipboard Formats[^] Then you can pass in the bitmap handle in the storage structure.

      M 1 Reply Last reply
      0
      • D Dave Calkins

        See the below. Clipboard: Using the OLE Clipboard Mechanism[^] When you call the function to cache the data, you can use the bitmap standard clipboard type documented below. Clipboard Formats[^] Then you can pass in the bitmap handle in the storage structure.

        M Offline
        M Offline
        mla154
        wrote on last edited by
        #3

        I tried the following: BOOL CMyFormView::PutDataToClipboard(CBitmap *pBmp) { COleDataSource *pods = new COleDataSource;; HBITMAP hBmp = (HBITMAP) *pBmp; int i = sizeof(*pBmp); HANDLE hData = ::GlobalAlloc(GMEM_FIXED, sizeof(*pBmp)); CBitmap* pData = (CBitmap*) ::GlobalLock (hData); pData = pBmp; BOOL l = ::GlobalUnlock(hData); STGMEDIUM stg; stg.tymed = TYMED_GDI; stg.hBitmap = hBmp; stg.pUnkForRelease = NULL; // Place the data object on the OLE clipboard. CFormApp* ab = (CFormApp*)AfxGetApp(); pods->CacheData(CF_BITMAP, &stg); pods->SetClipboard(); //ab->pods->CacheData (CF_BITMAP, &stg); //ab->pods->SetClipboard (); delete pods; return TRUE; } I'm unable to paste the bitmap in mspaint (and other places). Any ideas? -- modified at 15:20 Tuesday 29th August, 2006

        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