console window together with a WinForm application?
i need a console window together with a WinForm application.
like:http://www.codeproject.com/csharp/console.asp
public class Win32
{
[DllImport("kernel32.dll")]
public static extern Boolean AllocConsole();
[DllImport("kernel32.dll")]
public static extern Boolean FreeConsole();
}
but it only works in "Debug" , can't works in "Release" model.
any ideas?
[526 byte] By [
FelixLiu] at [2007-12-16]
Hi,
What version of VS are you using? coz there were discussions on the link that you provided. And it says it doesn't work well with VS2003. If your using 2003 then I suggest you use the Debug.WriteLine if your trying to do this for debugging purposes...
cheers,
Paul June A. Domag
One easy way is to right-click on the Project in Solution Explorer and Choose Properties.
In the Application Dialog -> Output Type choose "Console Application" instead of Windows Forms. This way when you run your application it will show both a Console Window as well as the Windows Forms. Any output using Console.WriteLine will be sent to the Console window.
Regards,
Saurabh Nandu
www.MasterCSharp.com
www.AksTech.com