Clipbaord copy
-
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?
-
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?
Try passing hGlobalMemory instead of lpGlobalMemory in SetClipboardData function.