Hilfe CreateProcess(
-
#include <windows.h> #include <iostream> #include <string> using namespace std; int main(int argc, char* argv[]) { STARTUPINFO si; PROCESS_INFORMATION pi; 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). _T("\"C:\\Program Files\\Windows Media Player\\wmplayer.exe\""),// 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. ) { //ErrorExit( "CreateProcess failed." ); } CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); return 0; }
Wieso functioniert das nicht will so was ehliches machen wie das hier.
system("\"C:\\Program Files\\Windows Media Player\\wmplayer.exe\"");
aber halt nur mit CreateProcess. Also den media player irgentwie strarten. Weis einer was fahlsch hier ist?.
-
Der 2.Parameter von CreateProcess darf nicht const sein,
probiere mal#undef UNICODE #undef _UNICODE ... char cmd[256];
und als 2.Parameter dann:
strcpy(cmd,"cmd /c start wmplayer"),
Muss es denn unbedingt CreateProcess sein, reicht nicht auch
system("start wmplayer");
?
Deine Kenntnisse in der Sprache Deutsch sind übrigens auch recht mangelhaft.