1Mar/101
Use clipboard (copy/paste) in C# console application
This took me few minutes to figure out and was quite annoying. First you must add a reference to System.Windows.Forms in your application. Go to Project -> Add reference, select System.Windows.Forms from .NET tab in the window that just opened. You must avoid the ThreadStateException by applying the STAThread attribute to your Main() function. Then you can use the Clipboard functions without any problems.
1 2 3 4 5 6 7 8 9 | using System; using System.Windows.Forms; class Program { [STAThread] static void Main(string[] args) { Clipboard.SetText("this is in clipboard now"); } } |
Related posts:
- Communicate betwen C# and an embeded Flash application
- How to clone (duplicate) an object in ActionScript 3
- How to identify at runtime if the swf is in debug or release mode/build

May 10th, 2011 - 00:09
Thanks!