954,504 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

C++ Copy a string to Clipboard

:D Hello everyone,

I am making a program where the user types in a string and then the string is saved to the clipboard, but I am not quite sure how. I have had a look at http://www.cplusplus.com/forum/beginner/33250/ but I am not quite sure how to implement this.

I would greatly appreciate any help offered because I am a beginner.

Thanks,
Muhasaresa

Muhasaresa
Newbie Poster
3 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

You need to Windows API to work with these functions, and #include "Windows.h". The reference for these functions is located here .

Be sure to check the return value of OpenClipboard(). If it returns a zero (false) it failed, otherwise, if it returns a non-zero (true) it succeeded. If it returns false, another program likely has access to it, so you should wait briefly and try again.

nmaillet
Posting Whiz in Training
236 posts since Aug 2008
Reputation Points: 69
Solved Threads: 53
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: