I’m currently launching a dedicated from in game using a DLL bind and this command:
ShellExecute(NULL, "open", "..\\MyGame.exe", "server", NULL, SW_SHOWNOACTIVATE);
Works great, however it’s cmd console always steals the focus from the currently running game.
I know I can pass “-silent” as a param (which works), however then the only way to find the process is to go into the task manager.
So how would i still allow the server’s cmd window to open, but not steal focus from the game?
Thanks in advance
So i figured out i could just create an additional shortcut to the game .exe and set the Run param to minimized.
I wouldn’t use ShellExecute there. FPlatformProcess is the UE4 way to spawn a process like that and is platform independent. UTAlpha had a good example of exactly what you’re looking to do (look in UTLocalPlayer.cpp/h) but it might have deprecated a little over time. Essentially, use FPlatformProcess::CreateProc to spawn the dedicated server and hold a reference to the ProcHandle so you can controlling/manage/verify it from the client. Just set bLaunchHidden to true. For bonus points, you can setup Beacons to crosstalk.