Archived

This topic is now archived and is closed to further replies.

Clipboard Blues

This topic is 5699 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a way to access what is in the clipboard if my application doesnt own it? I just need to take whatever is in the clipboard at the time and store it to a variable. I tried making heads or tails of this at MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/clipbrd_1xwk.asp but.... i was unsuccessful. I figure maybe someone here has experience with accessing the clipboard without taking explicit control over it like that implementation does. Thanks for the help in advance.

Share this post


Link to post
Share on other sites
i was actually looking for some sort of method of implementation. Not a yes or no..... You see my post is asking about help on the situation, not polling your experience. Try to reply better please.

k thanks.

Share this post


Link to post
Share on other sites
fine. here''s an example i typed up, since you obviously cannot use a search engine to figure it out yourself.


  
#include <iostream.h>
#include <windows.h>
void main(HWND hwnd)
{
char *text;
OpenClipboard hwnd;
text = GetClipboardData(CF_TEXT);
CloseClipboard();
cout << text << endl;
}


i don''t know if i made an error by mistake as I typed it here, but compile it, it should work fine.

Share this post


Link to post
Share on other sites
Actually i DID research. but youre right the answer was obvious. Code goes likes this. Yours is wrong

OpenClipboard(hwnd);
szString=(char*)GetClipboardData(CF_TEXT);
// code handling whats in clipboard here
CloseClipboard();



anyway thanks for trying to help. You need to chill on elitism though.....

Share this post


Link to post
Share on other sites