Problème avec CreateProcess

Résolu
cs_mioux Messages postés 7 Date d'inscription lundi 10 novembre 2003 Statut Membre Dernière intervention 2 juillet 2009 - 27 mai 2005 à 14:00
cs_mioux Messages postés 7 Date d'inscription lundi 10 novembre 2003 Statut Membre Dernière intervention 2 juillet 2009 - 30 mai 2005 à 00:38
Salut

Je cherche une solution à un problème tout bête... il faut que je lance un programme et que j'attende qu'il s'arrete pour continuer l'exécution du mien...

void launch(char *file)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;

command_line_add(file);

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

// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
filecom, // 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.
)
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
return;
}

// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );

// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}

"file" contient une chaine de caractère indiquant une vidéo (par ex : ".\\video\\Burning.avi") et "command_line_add" transforme le pointeur pour y ajouter le chemin du lecteur (mais si il faut, je peux enlever ce code).
ShellExecute fonctionne mais mon programme continue alors que ma vidéo tourne.
Ce code me renvoie "CreateProcess failed (2)." et j'ai pas trouvé à quoi correspond le code de retour 2. Si quelqu'un pouvait m'aider, ca serait sympa ;p
A voir également:

5 réponses

bayeto Messages postés 224 Date d'inscription mardi 12 août 2003 Statut Membre Dernière intervention 18 octobre 2010
29 mai 2005 à 14:36
2? Alors c'est fichier introuvable ça...


mayonaise tournera, bientôt, très bientôt...
3
Rejoignez-nous