views:

186

answers:

2

I've written an application with the following in the Program.cs:

        rsCursor.Wait();

        // Load the settings
        rsAppConfig.LoadConfig("iVirtualDocket.exe.config");

        fSplash splash = new fSplash(IvdConfig.VERSION);
        splash.Initialise();

        DialogResult result = splash.ShowDialog();
        rsCursor.Go();

        if (result == DialogResult.Yes)
        {
            IvdInstances.Main.Initialise();
            Application.Run(IvdInstances.Main);
        }

I use full screen on all my forms, so there is no X button, however I thought using Form.Close() performed the same function?

I want to be able to minimise my application from my main menu (Main) and then have it instantly appear again when the user re-runs the application. At the moment, my application executes the loading screen every time I re-run the application.

What am I doing wrong?

Thanks in advance.

EDIT: I need to be able to detect when my application is running and then restore the main menu when it is so that it's not constantly loading itself into memory.

+2  A: 

Form.Close closes the Form. There is no Minimize - use Hide and Show.

ctacke
+1  A: 
[System.Runtime.InteropServices.DllImport("coredll.dll")]
static extern int ShowWindow(IntPtr hWnd, int nCmdShow);

ShowWindow(this.Handle, SW_MINIMIZED);

This did the trick, this.Hide() didn't work as it didn't maximise the window again when I re-ran the app.

GenericTypeTea

related questions