开发者

How to specify last form in Windows forms application in Console Application?

开发者 https://www.devze.com 2023-03-30 20:19 出处:网络
static class Program { /// <summary> /// The main entry point for the application. /// </summary>
    static class Program
{
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
    {
        Thread thread = new Thread(new ThreadStart(Debug));
        thread.Start();
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new MainForm());
    }

    static void Debug()
    {开发者_运维百科
        Console.WriteLine(Console.ReadLine());
    }

I have something like that. It launchs a console and a windows form. What I want to do is Hide or close the console application without terminating the whole application and show it later by pressing a button or something like that from form. How can I prevent the application from closing?

Can't we just fit up a console in windows form? My real problem is I'm writting an windows forms application. Also I want a window (console window) that will execute and test some functions on windows forms.


Something similar answered here: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/ea8b0fd5-a660-46f9-9dcb-d525cc22dcbd

Basically, seems like you need to call some windows API functions to show/hide the console.

0

精彩评论

暂无评论...
验证码 换一张
取 消