I'm currently coding a formatter for the clipboard : when it finds a certain thing on the clipboard, it will modify it, empty the clipboard, and put the new modified data onto the clipboard, ready for the user to paste elsewhere. However, I'm having the following troubles :
1.
In this function, I'm using uFormat as CF_TEXT, to get my data as plain text. However, I'm not sure how to use it. When I have something on the clipboard and use this function, I try to use it usingCode:GetClipboardData(unsigned int uFormat);
and get "0x0" out of it. I'm not sure I'm using it properly, but I can't think of another way.Code:cout << GetClipboardData(CF_TEXT);
2.
I'm unsure about the variable HWND hData. I would like to insert plain text into the Clipboard, or perhaps from a .txt file, but have seen no working examples of this. Furthermore, many of these examples seem to use calls to GlobalAlloc, which I would prefer to avoid, if it is possible.Code:SetClipboardData(unsigned int uFormat, HWND hData);
So far, my code simply opens the Clipboard, gets data, prints it to screen, clears the Clipboard and sets new data which I should be able to see by hitting CTRL + V, but I'm not able to retrieve from the data ( I get "0x0" ), and I can't set the data.
I've searched this board, I've been at MSDN, at CodeProject, etc., and cannot find the answer to my problem.
Thanks for your help.



LinkBack URL
About LinkBacks



Is there no simple way so copy plain text into the Clipboard ? I don't even understand the code under EditCopy and EditPaste at MSDN, and would have no idea what to do with it.