jjzjj

c++ - 从 ShellExecute 获取 PID

我正在从ShellExecuteEx启动一个进程,我确实需要获取ProcessID(这是此类要求的一部分)。不知何故,所有重要的SHELLEXECUTEINFO都返回null。因此,例如,如果我使用此代码:exInfo.lpVerb="open";exInfo.lpFile="C:\\Windows\\system32\\cmd.exe";exInfo.nShow=5;ShellExecuteExA(exInfo);它启动了CMD.exe。但现在我需要得到它的PID。exInfo.hwnd返回0,exInfo.hProcess返回null。这是正常行为吗?我真的不想使用CreatePr