0

我有一个名为“reg.exe”的第三方控制台应用程序。当我运行它时,它会显示一条短信。我想在我的应用程序中使用这个字符串。我如何得到这个字符串?

我想用CreatProcess来执行“reg.exe”,

CreateProcess( NULL,   // No module name (use command line)
        argv[1],        // 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

然后使用

WaitForSingleObject( pi.hProcess, INFINITE );

等待它完成。

4

0 回答 0