|
I need an mfc api or method to copy the contents of a variable into the windows clipboard. | | garedkarl Tuesday, September 15, 2009 5:32 AM | use namespace System.Windows.Forms or use SetClipboardData( UINT uFormat, HANDLE hMem); for more information http://msdn.microsoft.com/en-us/library/ms649051(VS.85).aspx- Marked As Answer byAland LiMSFT, ModeratorWednesday, September 16, 2009 6:55 AM
- Proposed As Answer byBharath kumar Y.S Tuesday, September 15, 2009 9:13 AM
-
| | Bharath kumar Y.S Tuesday, September 15, 2009 8:46 AM |
Clipboard.SetText(<variable value>
)
is this whatyou wanted.. - Proposed As Answer byBharath kumar Y.S Tuesday, September 15, 2009 5:49 AM
- Marked As Answer byAland LiMSFT, ModeratorWednesday, September 16, 2009 6:55 AM
-
| | Bharath kumar Y.S Tuesday, September 15, 2009 5:40 AM | Following link could help
http://www.ex-designz.net/apidetail.asp?api_id=610
For text in a string variable you can use "CF_TEXT". For this link given by bharathkumar will be useful Or you can use System.Windows.Forms.Clipboard.SetText("Hello", TextDataFormat.Text)
Gaurav Khanna - Marked As Answer byAland LiMSFT, ModeratorWednesday, September 16, 2009 6:56 AM
- Proposed As Answer byKhanna Gaurav Tuesday, September 15, 2009 10:19 AM
-
| | Khanna Gaurav Tuesday, September 15, 2009 10:19 AM | HGLOBAL hText; hText = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, sizeof(str_data)); pText = GlobalLock(hText); strcpy(pText, str_data); GlobalUnlock(hText); OpenClipboard(hDlg); EmptyClipboard(); SetClipboardData(CF_TEXT, hText); CloseClipboard(); check if this can work.. for more information check http://www.codeguru.com/forum/archive/index.php/t-290608.html- Marked As Answer byAland LiMSFT, ModeratorWednesday, September 16, 2009 6:56 AM
- Proposed As Answer byBharath kumar Y.S Tuesday, September 15, 2009 10:31 AM
-
| | Bharath kumar Y.S Tuesday, September 15, 2009 10:29 AM | declare pTex as char * and then try
pText =(char*) GlobalLock(hText); - Proposed As Answer byBharath kumar Y.S Tuesday, September 15, 2009 12:48 PM
- Marked As Answer byAland LiMSFT, ModeratorWednesday, September 16, 2009 6:56 AM
-
| | Bharath kumar Y.S Tuesday, September 15, 2009 12:48 PM |
Clipboard.SetText(<variable value>
)
is this whatyou wanted.. - Proposed As Answer byBharath kumar Y.S Tuesday, September 15, 2009 5:49 AM
- Marked As Answer byAland LiMSFT, ModeratorWednesday, September 16, 2009 6:55 AM
-
| | Bharath kumar Y.S Tuesday, September 15, 2009 5:40 AM | yeah i think so... but wat header do i need to include for this??
i get the error "'Clipboard' : undeclared identifier".. | | garedkarl Tuesday, September 15, 2009 6:07 AM | use namespace System.Windows.Forms or use SetClipboardData( UINT uFormat, HANDLE hMem); for more information http://msdn.microsoft.com/en-us/library/ms649051(VS.85).aspx- Marked As Answer byAland LiMSFT, ModeratorWednesday, September 16, 2009 6:55 AM
- Proposed As Answer byBharath kumar Y.S Tuesday, September 15, 2009 9:13 AM
-
| | Bharath kumar Y.S Tuesday, September 15, 2009 8:46 AM | Thanks dude... but im still kinda confused regarding the syntax.
Can u give me a sample code to copy the contents of a string say str_data to the windows clipboard so that i can paste it in some other application (like notepad)
Thanks
Gared
| | garedkarl Tuesday, September 15, 2009 10:12 AM | Following link could help
http://www.ex-designz.net/apidetail.asp?api_id=610
For text in a string variable you can use "CF_TEXT". For this link given by bharathkumar will be useful Or you can use System.Windows.Forms.Clipboard.SetText("Hello", TextDataFormat.Text)
Gaurav Khanna - Marked As Answer byAland LiMSFT, ModeratorWednesday, September 16, 2009 6:56 AM
- Proposed As Answer byKhanna Gaurav Tuesday, September 15, 2009 10:19 AM
-
| | Khanna Gaurav Tuesday, September 15, 2009 10:19 AM | HGLOBAL hText; hText = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, sizeof(str_data)); pText = GlobalLock(hText); strcpy(pText, str_data); GlobalUnlock(hText); OpenClipboard(hDlg); EmptyClipboard(); SetClipboardData(CF_TEXT, hText); CloseClipboard(); check if this can work.. for more information check http://www.codeguru.com/forum/archive/index.php/t-290608.html- Marked As Answer byAland LiMSFT, ModeratorWednesday, September 16, 2009 6:56 AM
- Proposed As Answer byBharath kumar Y.S Tuesday, September 15, 2009 10:31 AM
-
| | Bharath kumar Y.S Tuesday, September 15, 2009 10:29 AM | Hi... i can understand the idea behind the syntax but there are still a few issues
like of what type ispText,hDlg.
pTex will need to be of a char type but that doesnt match withGlobalLock return type.. | | garedkarl Tuesday, September 15, 2009 11:53 AM | declare pTex as char * and then try
pText =(char*) GlobalLock(hText); - Proposed As Answer byBharath kumar Y.S Tuesday, September 15, 2009 12:48 PM
- Marked As Answer byAland LiMSFT, ModeratorWednesday, September 16, 2009 6:56 AM
-
| | Bharath kumar Y.S Tuesday, September 15, 2009 12:48 PM |
|