<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Console Output from a WinForms Application</title>
	<atom:link href="http://www.csharp411.com/console-output-from-winforms-application/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.csharp411.com/console-output-from-winforms-application/</link>
	<description>C# Development</description>
	<lastBuildDate>Fri, 03 Feb 2012 11:14:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Konsolenausgaben in einer WindowsForms Applikation &#171; BigBasti&#039;s Blog</title>
		<link>http://www.csharp411.com/console-output-from-winforms-application/#comment-38885</link>
		<dc:creator>Konsolenausgaben in einer WindowsForms Applikation &#171; BigBasti&#039;s Blog</dc:creator>
		<pubDate>Tue, 17 Jan 2012 12:14:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/console-output-from-winforms-application/#comment-38885</guid>
		<description>[...] Infos und auch eine kleine Diskussion gibts hier und hier.   Share and [...]</description>
		<content:encoded><![CDATA[<p>[...] Infos und auch eine kleine Diskussion gibts hier und hier.   Share and [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dextero</title>
		<link>http://www.csharp411.com/console-output-from-winforms-application/#comment-100</link>
		<dc:creator>dextero</dc:creator>
		<pubDate>Wed, 27 Jul 2011 18:35:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/console-output-from-winforms-application/#comment-100</guid>
		<description>I managed to hide the command prompt in by filling the entire row with spaces, works fine for me:

using System;
using System.IO;

static class Program
{
    [DllImport(&quot;kernel32.dll&quot;)]
    static extern bool AttachConsole(UInt32 dwProcessId = 0xffffffff);

    [STAThread]
    static void Main()
    {
        try
        {
            AttachConsole();
            Console.Write(&quot;r&quot;); // go back to the first column of a console window
            for (int i = 0; i &lt; Console.WindowWidth - 1; ++i, Console.Write(&quot; &quot;)) ; // fill a row with spaces, overwriting command prompt. note: the last character can&#039;t be overwritten, because console cursor moves to the next line
            Console.Write(&quot;r&quot;); // go back to the first column
        }
        // Console.WindowWidth throws an IOException when there&#039;s no console window, so ignore it
        catch (IOException ex) { }

        // ...
    }
}</description>
		<content:encoded><![CDATA[<p>I managed to hide the command prompt in by filling the entire row with spaces, works fine for me:</p>
<p>using System;<br />
using System.IO;</p>
<p>static class Program<br />
{<br />
    [DllImport("kernel32.dll")]<br />
    static extern bool AttachConsole(UInt32 dwProcessId = 0xffffffff);</p>
<p>    [STAThread]<br />
    static void Main()<br />
    {<br />
        try<br />
        {<br />
            AttachConsole();<br />
            Console.Write(&#8220;r&#8221;); // go back to the first column of a console window<br />
            for (int i = 0; i &lt; Console.WindowWidth &#8211; 1; ++i, Console.Write(&quot; &quot;)) ; // fill a row with spaces, overwriting command prompt. note: the last character can&#039;t be overwritten, because console cursor moves to the next line<br />
            Console.Write(&quot;r&quot;); // go back to the first column<br />
        }<br />
        // Console.WindowWidth throws an IOException when there&#039;s no console window, so ignore it<br />
        catch (IOException ex) { }</p>
<p>        // &#8230;<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.csharp411.com/console-output-from-winforms-application/#comment-99</link>
		<dc:creator>John</dc:creator>
		<pubDate>Mon, 27 Jun 2011 23:26:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/console-output-from-winforms-application/#comment-99</guid>
		<description>Sorry, please ignore my comment regarding the SendWait line!
It&#039;s not needed when the application&#039;s output type is &quot;Console Application&quot;, but it IS needed when the type is &quot;Windows Application&quot;.</description>
		<content:encoded><![CDATA[<p>Sorry, please ignore my comment regarding the SendWait line!<br />
It&#8217;s not needed when the application&#8217;s output type is &#8220;Console Application&#8221;, but it IS needed when the type is &#8220;Windows Application&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.csharp411.com/console-output-from-winforms-application/#comment-98</link>
		<dc:creator>John</dc:creator>
		<pubDate>Mon, 27 Jun 2011 23:02:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/console-output-from-winforms-application/#comment-98</guid>
		<description>I like the simplicity of Ben&#039;s solution, however, the flashing console window is annoying. So I still like the I/O redirection approach above better.

Additionally, I found that this line is not really necessary. My program exits properly w/o waiting for an Enter.

System.Windows.Forms.SendKeys.SendWait(&quot;{ENTER}&quot;); // not needed

Thanks all!</description>
		<content:encoded><![CDATA[<p>I like the simplicity of Ben&#8217;s solution, however, the flashing console window is annoying. So I still like the I/O redirection approach above better.</p>
<p>Additionally, I found that this line is not really necessary. My program exits properly w/o waiting for an Enter.</p>
<p>System.Windows.Forms.SendKeys.SendWait(&#8220;{ENTER}&#8221;); // not needed</p>
<p>Thanks all!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.csharp411.com/console-output-from-winforms-application/#comment-97</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Mon, 21 Mar 2011 16:57:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/console-output-from-winforms-application/#comment-97</guid>
		<description>Hi Jeff, my final solution is to FreeConsole if the console is not needed. Please check my post for details: 
http://benincampus.blogspot.com/2011/03/re-console-output-from-winforms.html</description>
		<content:encoded><![CDATA[<p>Hi Jeff, my final solution is to FreeConsole if the console is not needed. Please check my post for details:<br />
<a href="http://benincampus.blogspot.com/2011/03/re-console-output-from-winforms.html" rel="nofollow">http://benincampus.blogspot.com/2011/03/re-console-output-from-winforms.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: roger</title>
		<link>http://www.csharp411.com/console-output-from-winforms-application/#comment-96</link>
		<dc:creator>roger</dc:creator>
		<pubDate>Sun, 13 Mar 2011 05:14:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/console-output-from-winforms-application/#comment-96</guid>
		<description>@Jeff
If you call AttachConsole( ATTACH_PARENT_PROCESS ) then it &quot;shouldn&#039;t&quot; open up a new window.  AllocConsole always does, though.  I think.</description>
		<content:encoded><![CDATA[<p>@Jeff<br />
If you call AttachConsole( ATTACH_PARENT_PROCESS ) then it &#8220;shouldn&#8217;t&#8221; open up a new window.  AllocConsole always does, though.  I think.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Fielding</title>
		<link>http://www.csharp411.com/console-output-from-winforms-application/#comment-95</link>
		<dc:creator>Jeff Fielding</dc:creator>
		<pubDate>Wed, 02 Mar 2011 19:30:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/console-output-from-winforms-application/#comment-95</guid>
		<description>Ben, I like your solution with one reservation that unfortunately makes it unusable for me.

After changing the application property &quot;Output Type&quot; from &quot;Windows Application&quot; to &quot;Console Application&quot; the application still functions as a Windows Application. Starting it as a console application gives the usual console application capabilities such as console output and I/O redirection. 

The unfortunate part is that, when running as a Windows Application a console window is automatically opened (which disappears when the Windows Application is closed). Does anyone know a way to inhibit display of the console window?</description>
		<content:encoded><![CDATA[<p>Ben, I like your solution with one reservation that unfortunately makes it unusable for me.</p>
<p>After changing the application property &#8220;Output Type&#8221; from &#8220;Windows Application&#8221; to &#8220;Console Application&#8221; the application still functions as a Windows Application. Starting it as a console application gives the usual console application capabilities such as console output and I/O redirection. </p>
<p>The unfortunate part is that, when running as a Windows Application a console window is automatically opened (which disappears when the Windows Application is closed). Does anyone know a way to inhibit display of the console window?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hartmut Honisch</title>
		<link>http://www.csharp411.com/console-output-from-winforms-application/#comment-94</link>
		<dc:creator>Hartmut Honisch</dc:creator>
		<pubDate>Tue, 25 Jan 2011 08:14:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/console-output-from-winforms-application/#comment-94</guid>
		<description>@Ben: Yeah, except it&#039;s no longer a WinForms application when you change it to Console Application.</description>
		<content:encoded><![CDATA[<p>@Ben: Yeah, except it&#8217;s no longer a WinForms application when you change it to Console Application.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.csharp411.com/console-output-from-winforms-application/#comment-93</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Mon, 24 Jan 2011 16:43:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/console-output-from-winforms-application/#comment-93</guid>
		<description>Got a better solution:
Right click the project and select &quot;Property&quot;, in the Application tab, you can see &quot;Output Type:&quot; is &quot;Windows Application&quot; in default for Form application. Change it to Console Application, there is no modification needed in your source code. All problem solved. The output can be redirected to text file, and the command prompt is not messed up.</description>
		<content:encoded><![CDATA[<p>Got a better solution:<br />
Right click the project and select &#8220;Property&#8221;, in the Application tab, you can see &#8220;Output Type:&#8221; is &#8220;Windows Application&#8221; in default for Form application. Change it to Console Application, there is no modification needed in your source code. All problem solved. The output can be redirected to text file, and the command prompt is not messed up.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NizZ8</title>
		<link>http://www.csharp411.com/console-output-from-winforms-application/#comment-92</link>
		<dc:creator>NizZ8</dc:creator>
		<pubDate>Fri, 19 Nov 2010 02:09:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.mini-tools.com/at2/csharp/wordpress/console-output-from-winforms-application/#comment-92</guid>
		<description>Thanks for posting this (and great comments)!</description>
		<content:encoded><![CDATA[<p>Thanks for posting this (and great comments)!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

