Remotely start new server instance

Hey Guys

I wonder if anybody can help me. What would be the best way to start a new server instance from my game code ?

Basically I want to start a new server instance ( MyServer.exe ) and then tell clients to connect to it. I have an idea how to implement telling the clients to connect to it, I just want to know how I’m able to start an external program from within my code.

Thanks A

EDIT: Ok I was able to solve it with help from google :smiley:

Here’s the code for anybody they need it:

#include <string>

        STARTUPINFO si;

	ZeroMemory(&si, sizeof(si));
	si.cb = sizeof(si);
	ZeroMemory(&pi, sizeof(pi));

	std::wstring MyProgram(L"C:\\windows\\system32\

	// start the program up
	CreateProcess(MyProgram.c_str() ,   // the path
		NULL,			// Command line
		NULL,           // Process handle not inheritable
		NULL,           // Thread handle not inheritable
		false,          // Set handle inheritance to FALSE
		0,              // No creation flags
		NULL,           // Use parent's environment block
		NULL,           // Use parent's starting directory 
		&si,            // Pointer to STARTUPINFO structure
		&pi);           // Pointer to PROCESS_INFORMATION structure