Archived

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

noober

Clipboard Blues

Recommended Posts

noober    122
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
noober    122
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
sporty    122
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
noober    122
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