Hello,
I am writing a c++ program for windows using the API. My program needs to be able to get some text from the clipboard, import it to the program's scope as a string, and do work on the string.
[what I have tried]
cout << GetClipboardData(CF_TEXT) << endl;
cout << GetClipboardData(CF_UNICODETEXT) << endl;
Both of these printed/returned zero, which, msdn says, means the functions failed.
I found the MSDN documentation wanting...an example would have been nice.
http://msdn.microsoft.com/en-us/library/ms907128.aspx
Even if the above functions returned a non-zero result, I am not sure how I would use the returned data handle to get the data as a string.
[other ideas]
I could post a paste message to a temporary text file, then import the text using fstream, but this is rather a backwards way of going about it.
I am hoping someone would please shed some light on how to get text from the clipboard as a string into my c++ program.
Thanks,