Clipboard Blues
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.
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.
k thanks.
fine. here''s an example i typed up, since you obviously cannot use a search engine to figure it out yourself.
i don''t know if i made an error by mistake as I typed it here, but compile it, it should work fine.
#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.
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.....
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.....
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement