Program Modal starten



  • Ich möchte aus meinem prog heraus ein anderes starten und zwar modal. So, dass mein prog auf keine Eingabe reagiert so lange das aufgerufene prog läuft. geht das?



  • aus der MSDN:

    // Start the child process. 
        if( !CreateProcess( NULL, // No module name (use command line). 
            "MyChildProcess", // 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." );
        }
    
        // Wait until child process exits.
        WaitForSingleObject( pi.hProcess, INFINITE );
    


  • Das friert das Proggi aber doch nur ein, oder? Ich denke, es entsteht jedenfalls kein Piepton, wenn man versucht, auf ein Fenster der aufrufenden Anwendung zu klicken.



  • Dann macht man noch ein EnableWindow(hWnd, FALSE) vor das WaitForSingleObject; und ein EnableWindow(hWnd, TRUE) danach, dann müsste das funktionieren.


Anmelden zum Antworten