almost 5 years ago - Toolguy - Direct link

I believe the only way at the moment to get the server to cleanly close is to send it a WM_QUIT or WM_CLOSE message.

In the Dedicated Server Launcher tool, I actually use this code:

void DedicatedServerLauncher::ShutdownGameServer()
{
  DW_Print(INFOL_IMPORTANT, e_DedicatedServerLauncher, "Shutting down the game server");

  // http://stanislavs.org/stopping-command-line-applications-programatically-with-ctrl-c-events-from-net/
  HWND handle = dw::win32::FindProcessMainWindow(m_ServerProcessId);
  if (handle)
  {
    PostMessage(handle, WM_CLOSE, 0, 0);
    m_ServerShuttingDown = true;
  }
}

not sure if that will help you, but that’s all I have at the moment :slight_smile:

almost 5 years ago - Toolguy - Direct link

Interesting.

Have to see if that would work from a Win32 GUI C++ application, could be an alternate way to stop the program I guess.