: :
: "C:\\Program Files\\Diablo II\\game.exe" -did not work
: "C:\\\"Program Files\"\\\"Diablo II\"\\game.exe" -worked
You need something like this: The outmost quotes are for the C compiler and are not passed to the system() function.
system("\"D:\\Program Files\\Diablo II\\game.exe\"");
:
: What is up with all the slashes and quotes. What are they doing?
:
you need double quote when you wnat a literal slash in the string. Otherwise the C compiler will attempt to interpret the next character as an escape character, such as '\n', '\r', '\t' and others.
:
: stober, do I need a certain header for win32 api function CreateProcess()?
:
include windows.h
: stober, I load up 40 instances of d2 using d2loader on 3 comps and play them in window mode with the -w command after the target in the shortcut properties.
:
The below worked on my computer, where I installed Diablo on drive D:
STARTUPINFO sinfo;
PROCESS_INFORMATION pinfo;
memset(&sinfo,0,sizeof(STARTUPINFO));
memset(&pinfo,0,sizeof(PROCESS_INFORMATION));
sinfo.cb = sizeof(STARTUPINFO);
if( CreateProcess(0,"\"D:\\Program Files\\Diablo II\\game.exe\"", 0,0,0,0,0,0,&sinfo,&pinfo)== 0)
{
printf("Create Process failed\n");
}
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp