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. Clipbaord copy

Clipbaord copy

Scheduled Pinned Locked Moved C / C++ / MFC
question
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.
  • M Offline
    M Offline
    Member 6074
    wrote on last edited by
    #1

    I have an client application which as files i need to copy the a selected file into clipboard and paste it on the desktop or any where outside my client application Within my client application i am able to copy and paste files but not outside my client application. Here is the code void SetClipBoardStringData(CString str, int format ) { EmptyClipboard(); CString text = str; HANDLE hGlobalMemory = GlobalAlloc(GHND, (DWORD)(text.GetLength()+1)); HANDLE lpGlobalMemory = GlobalLock(hGlobalMemory); memcpy(lpGlobalMemory,(text),(text.GetLength())+1); SetClipboardData(format,lpGlobalMemory); GlobalUnlock(lpGlobalMemory); GlobalFree(hGlobalMemory); } I am calling this function. SetClipBoardStringData(sStrXML,CF_TEXT); This copies the sStrXML to the clipboard.This sStrXml contains the file contents. Now i want this clipboard contents to be availale outside the application so that i can paste it another application like notepad or a file in desktop. How do i do it?

    C 1 Reply Last reply
    0
    • M Member 6074

      I have an client application which as files i need to copy the a selected file into clipboard and paste it on the desktop or any where outside my client application Within my client application i am able to copy and paste files but not outside my client application. Here is the code void SetClipBoardStringData(CString str, int format ) { EmptyClipboard(); CString text = str; HANDLE hGlobalMemory = GlobalAlloc(GHND, (DWORD)(text.GetLength()+1)); HANDLE lpGlobalMemory = GlobalLock(hGlobalMemory); memcpy(lpGlobalMemory,(text),(text.GetLength())+1); SetClipboardData(format,lpGlobalMemory); GlobalUnlock(lpGlobalMemory); GlobalFree(hGlobalMemory); } I am calling this function. SetClipBoardStringData(sStrXML,CF_TEXT); This copies the sStrXML to the clipboard.This sStrXml contains the file contents. Now i want this clipboard contents to be availale outside the application so that i can paste it another application like notepad or a file in desktop. How do i do it?

      C Offline
      C Offline
      chirag_chauhan
      wrote on last edited by
      #2

      Try passing hGlobalMemory instead of lpGlobalMemory in SetClipboardData function.

      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