I'm developing an application to automate existing software using a combination of SendUserInput P/Invoke calls and various other things, I'm wondering how one goes about pasting the contents of the System Clipboard into an external application, would this require more calls to the Win32 or is there some .NET classes that would do this? - I can't see anything in System.Windows. Forms.Clipboard .
Paste Clipboard Externally - C#
Collapse
X
-
Tags: None
-
To: fluxcapacitor
I find the way (but there is problem, you can read it from down there).
See this code:
System.Windows. Forms.Clipboard .SetDataObject( "Your Text");
THE PROBLEM IS IF YOU CLOSE YOUR FORM THE CLIPBOARD TEXT WILL DELETING (CLEARING). TRY IT BY YOURSELF RUN YOUR FORM AND MAKE TO THE CLIPBOARD A TEXT, THEN DO NOT CLOSE YOUR FORM AND OPEN A NOTPAD AND CLICK PAST SO YOU WILL SEE YOUR WORD, BUT CLOSE YOUR FORM THEN YOU CAN NOT PAST ANY WORD IN THE NOTPAD. FOR FIX THIS PROBLEM THE FORM MUST SAVE IT SETTINGS AND I DO NOT KNOW HOW, BUT I KNOW IT USING VB.
Comment