<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ADM Blog &#187; .net</title>
	<atom:link href="http://blog.another-d-mention.ro/tag/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.another-d-mention.ro</link>
	<description>No matter how you see things, reality changes when you reach understanding</description>
	<lastBuildDate>Wed, 11 Aug 2010 08:07:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Use clipboard (copy/paste) in C# console application</title>
		<link>http://blog.another-d-mention.ro/programming/c/use-clipboard-copypaste-in-c-console-application/</link>
		<comments>http://blog.another-d-mention.ro/programming/c/use-clipboard-copypaste-in-c-console-application/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 20:04:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[clipboard]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[paste]]></category>

		<guid isPermaLink="false">http://blog.another-d-mention.ro/?p=805</guid>
		<description><![CDATA[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 -&#62; 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 [...]


Related posts:<ol><li><a href='http://blog.another-d-mention.ro/programming/communicate-betwen-c-and-an-embeded-flash-application/' rel='bookmark' title='Permanent Link: Communicate betwen C# and an embeded Flash application'>Communicate betwen C# and an embeded Flash application</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.another-d-mention.ro/wp-content/uploads/2010/03/net_logo.jpg-150x150.png" alt="net logo.jpg 150x150 Use clipboard (copy/paste) in C# console application" title="net_logo.jpg" width="150" height="150" class="alignleft size-thumbnail wp-image-806" />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 -&gt; Add reference, select <strong>System.Windows.Forms</strong> 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.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Windows.Forms</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #FF0000;">class</span> Program <span style="color: #000000;">&#123;</span>
    <span style="color: #000000;">&#91;</span>STAThread<span style="color: #000000;">&#93;</span>
    <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
         Clipboard.<span style="color: #0000FF;">SetText</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;this is in clipboard now&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>



<p>Related posts:<ol><li><a href='http://blog.another-d-mention.ro/programming/communicate-betwen-c-and-an-embeded-flash-application/' rel='bookmark' title='Permanent Link: Communicate betwen C# and an embeded Flash application'>Communicate betwen C# and an embeded Flash application</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.another-d-mention.ro/programming/c/use-clipboard-copypaste-in-c-console-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
