Different CreateProcess function returned process ID and Task Manager

1 void Proc()
2 {
3     STARTUPINFO si = { 0 };
4     PROCESS_INFORMATION pi = { 0 };
5     CreateProcess("c:/windows/system32/calc.exe", "", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
6     printf("进程ID=%d,进程句柄%d\n", pi.dwProcessId, pi.hProcess); 
7 }

 

After the code executes, open the calculator calc.exe, different pi.dwProcessId returned process ID and Task Manager in the PID.

 

Solution:

  By opening the code correctly Notepad notepad.exe

 

problem causes:

  The Internet to find some, did not find out why. If you have reason to know of, please leave a message. Thank you ~ ~

Guess you like

Origin www.cnblogs.com/HunterK/p/11287768.html