I use DevCpp.
Originally Posted by Salem
That wouldn't be a good solution. The program I'm planning to make will read the program path from an ini file and launch it. Then I would need a function to convert the path to the 8.3 format. There must be an easier solution.
Originally Posted by ZuK
EDIT: After I looked in your FAQ I found a solution to the problem. It isn't exactly what I want but it works:
The only problem is that it's limited to windows. Are there any other, more portable functions that does the same thing?
char szPath = "C:\\Program\\Windows Media Player\\wmplayer.exe";
PROCESS_INFORMATION pif; //Gives info on the thread and..
//..process for the new process
STARTUPINFO si; //Defines how to start the program
ZeroMemory(&si,sizeof(si)); //Zero the STARTUPINFO struct
si.cb = sizeof(si); //Must set size of structure
BOOL bRet = CreateProcess(
szPath, //Path to executable file
NULL, //Command string - not needed here
NULL, //Process handle not inherited
NULL, //Thread handle not inherited
FALSE, //No inheritance of handles
0, //No special flags
NULL, //Same environment block as this prog
NULL, //Current directory - no separate path
&si, //Pointer to STARTUPINFO
&pif); //Pointer to PROCESS_INFORMATION
if(bRet == FALSE)
MessageBox(HWND_DESKTOP,"Unable to start program","",MB_OK);
CloseHandle(pif.hProcess); //Close handle to process
CloseHandle(pif.hThread); //Close handle to thread