代码语言:javascript复制
// Test_of_callexe.cpp : Defines the entry point for the console application.
//
#include<stdafx.h>
#include <windows.h>
#include <stdio.h>
#include <conio.h>
int main(int argc, char * argv[]) {
STARTUPINFO si = {0};
si.cb = sizeof(si);
PROCESS_INFORMATION pi = {0};
CreateProcess(NULL, "NeNe_lesson2.exe", NULL, NULL, TRUE , 0, NULL, 0, &si, &pi);
CloseHandle(pi.hThread);
WaitForSingleObject(pi.hProcess, -1);
int nExitCode = 0;
::GetExitCodeProcess(pi.hProcess, (LPDWORD)&nExitCode);
CloseHandle(pi.hProcess);
// printf("press any key to continue...n");
//getchar();
return nExitCode;
}