Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
Z

Zundee

@Zundee
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Question on shutting down another program and wating for it to exit.
    Z Zundee

    Thanks for your help. After taking a look at the information provided I got it.

    C# question csharp sysadmin

  • Question on shutting down another program and wating for it to exit.
    Z Zundee

    Forgive my newbie question. I am trying to learn C#. I have utterly confused myself in trying to restart a server console. I do not have the server start on this yet but it locks up every time I restart and I am not real sure way. It shutsdown ok but then never makes the check if the process has exited. Can anyone give me a nudge in the right direction? Thanks

        public void restartserver(string serverrs, string serverloc)
        {
    
            Process p = Process.GetCurrentProcess();
            Process\[\] servername = Process.GetProcessesByName(serverrs);
            IntPtr serverHandle = FindWindow(null, serverloc);
            if (serverHandle == IntPtr.Zero)
            {
                if (serverrs == "arcemu-world")
                    {
                        btnWorldStatus.Text = "World Server is not running";
                    }
                    else
                    {
                        btnLogonStatus.Text = "Logon Server is not running";
                    }
                }
                else
                {
    
                    SetForegroundWindow(serverHandle);
                    SendKeys.SendWait("Shutdown{ENTER}");
                    FreeConsole();
                    bool mytrue = true;
                    while (mytrue)
                    {
                        if (p.HasExited)
                        {
                            mytrue = false;
    
                            if (serverrs == "arcemu-world")
                            {
                                btnWorldStatus.Text = "Closing....";
                            }
                            else
                            {
                                btnLogonStatus.Text = "Closing....";
                            }
    
                        }
                    }
                    
                }
                
            
        }
    
    C# question csharp sysadmin
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups