-4

I want to Copy Text from Other Windows and Paste in a Textbox in My C# Application,But there is a problem,When I copy text to ClipBoard,My Clipboard cleans,I want to create another Clipboard to solve this problem but how?> tell to windows save copied Data in Other space?And After That,get Copied Data From the space,And Reload Clipboard With previous copied Data.Thanks for yOur Help.

  • 4
    This site is for programming questions. It is not a place to dump your to-do list. – Marc B Oct 19 '16 at 14:30
  • You could make a keylogger and listen for your key combination and then copy the original clipboard. and to print it use sendkeys. because I assume it is very hard to read data from a window – Pepernoot Oct 19 '16 at 14:39

1 Answers1

0

Check MSDN documentation for Clipboard class.

You should be able to resolve your problem with GetDataObject() and SetDataObject(...) methods.

Example (untested):

var previousData = Clipboard.GetDataObject();
// TODO: copy text to your clipboard as you already do.
Clipboard.SetDataObject(previousData, true);
// TODO: proceed with usual operations.

Depending on the situation, you might even be able to solve the problem without using the clipboard. For instance by directly inserting text into the textbox of your application or reading from another program's window.

Community
  • 1
  • 1
Fabio Iotti
  • 1,480
  • 1
  • 16
  • 20