Copy string to clipboard

I'm working on a password generator program, and am trying to add a
"copy to clipboard" feature where the program saves the string to the clipboard so that it can be pasted into text boxes. Does anyone know how I would do this?

(I'm using a Windows 7 OS if it's different between APIs)
Last edited on
Hi here is an example of how to do it



1
2
3
4
5
6
7
      glob = GlobalAlloc(GMEM_FIXED,32);
      memcpy(glob,"it works",9);

      OpenClipboard(hWnd);
      EmptyClipboard();
      SetClipboardData(CF_TEXT,glob);
      CloseClipboard();


Hope this is what you were after
Shredded
Topic archived. No new replies allowed.