Reputation: 57
I try to get PID of process which i started by my app.
DWORD dwPid = GetProcessId(pi.hProcess);
Somewhere on this forum is this solution but i dont have func "GetProcessId"
To start process i'm using:
BOOL bSuccess = FALSE;
LPTSTR pszCmd = NULL;
PROCESS_INFORMATION pi;// = {0};
STARTUPINFO si = {0};
si.cb = sizeof(si);
pszCmd = ""; /* assign something useful */
bSuccess = CreateProcess("D:\\program\\program.exe",NULL, NULL, NULL, TRUE, 0, NULL, "D:\\program", &si, &pi);
if (bSuccess)
{
}
Upvotes: 0
Views: 2144
Reputation: 154846
According to the documentation on PROCESS_INFORMATION
, you can access the process id directly from the PROCESS_INFORMATION
struct by accessing the dwProcessId
member:
DWORD dwPid = pi.dwProcessId;
Upvotes: 1