Hi: First thank you for this article which had hepled me to learn how to deal with clipboard. I've a remark, the OpenClipboard function should take an argument (HWND) which it is not the case here.
ReplyOriginally posted by: erhan
How can I get data from i.e explorer applet window..
input box element or list element text area.
thanks.
Dear erhan, have you got an answer ? I am very interested about it. Thanks, Hansruedi Tscheulin tscheulin@bluewin.ch
ReplyOriginally posted by: Timothy C. Alvord
I am looking for help in developing a SysTray app that will catch the pressing of the three Function keys F2, F3 and F4 and perform the same functions as CTRL-X, CTRL-C and CTRL-V. Any help would be greatly appreciated.
Thanks,
Tim
Originally posted by: Sikachev Peter
If you have some ideas send'em 2 my mail, please.
mail_to: garret-lit@yandex.ru
Originally posted by: Radu
Hi,
1) At first sight the code worked fine. However after some copy operations I got an access violation on the line:
buffer = (char*)GlobalLock(clipbuffer);
2) Something else seems to be wrong here. The "buffer" is initialized with some crap in it. I had a "," at the beginning of the buffer and in some cases also some other characters.
Any idea why?
Thanks for your effort.
ReplyOriginally posted by: mercy
hi all,
ihave a ActiveX control in the clipboard.what is the Format that i should use in the fn GetClipboardData(UINT uFormat) to get that control.
thanks
mercy
Originally posted by: YY
I tried this in Windows CE 3.0 with embdedded visual tool 3.0 and it does not seem to be putting stuff on the clipboard:
char source[100] = "Try This one";
if ( OpenClipboard (NULL) )
{
HLOCAL clipbuffer;
char * buffer;
EmptyClipboard ();
clipbuffer = LocalAlloc (0, sizeof(source) + 1);
buffer = (char*) LocalLock (clipbuffer);
strcpy (buffer, LPSTR (source) );
LocalUnlock (clipbuffer);
SetClipboardData (CF_TEXT, clipbuffer);
CloseClipboard ();
}
return (0);
Originally posted by: S.K.Pradhan
Thanx a lot for this posting. Given below is the code which will check for TEXT data in clipboard before copying to the destination string.
UINT cbFormat=0;
bool bTextFormat=0;
char *myDestStr;
if(OpenClipboard())
{
while(cbFormat=EnumClipboardFormats(cbFormat))
{
if (cbFormat==CF_TEXT) bTextFormat=1;
}
if(bTextFormat)
{
myDestStr=(char*)GetClipboardData(CF_TEXT);
AfxMessageBox(myDestStr);
}
else AfxMessageBox("NO Text data in clipboard");
}
else AfxMessageBox("Could not open clipboard, some other task might be in use.");
Regards
SKP
Originally posted by: Michel Bouchet
Here is the way I solved the problem (mentioned by myself in the previous article) :
1) I used RegisterClipboardFormat to create my own format, since none of the standard (CF_TEXT ...) seems to correspond to my needs :
UINT CF_BINFormat;
CF_BINFormat=RegisterClipboardFormat("CF_MYBINFORMAT");
.....
2) then I changed :
SetClipboardData(CF_TEXT,....
to become :
SetClipboardData(CF_BINFormat,......
and :
buffer = (char*)GetClipboardData(CF_TEXT);
to become :
buffer =(unsigned char*)GetClipboardData(CF_BINFormat);
Then I basically followed the example using memcpy() instead of strcpy() since my data are not necessarily NULL terminated.
If somebody thinks this is not the proper way to deal with the clipboard. Please let me know.
Reply
Originally posted by: Michel Bouchet
Thanks for posting this example.
It helped me to understand the basic way to use a clipboard in an application.
But what if I need to store arbitrary data in the clipboard. I mean not only text but any string of bytes which might also of course include 0x00 or any other values.
Thanks for any clue.
Reply