/** Sample source to call RADISSUPTO.EXE **/ #include #include #include #include /******************************************************************************/ void start_proc(int wait_for_it) { STARTUPINFO si; PROCESS_INFORMATION pi; memset(&si, 0, sizeof(si)); si.cb = sizeof(si); memset(&pi,0, sizeof(pi)); char path_exe[] = "C:\\supto\\RADISSUPTO.EXE P:\SUPTO FN:FP_00321.TXT"; char path_working_dir[] = "C:\\supto"; if(!CreateProcess( NULL, // lpApplicationName path_exe, // lpCommandLine NULL, // lpProcessAttributes NULL, // lpThreadAttributes FALSE, // bInheritHandles 0, // dwCreationFlags NULL, // lpEnvironment path_working_dir, // lpCurrentDirectory &si, // lpStartupInfo &pi // lpProcessInformation )) { DWORD error = GetLastError(); printf("Error %lu\n", error); } if (wait_for_it){ WaitForSingleObject( pi.hProcess, INFINITE ); CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); } } /******************************************************************************/ int main(int argc, char const *argv[]) { printf("Proc has started\n"); start_proc(1); printf("Proc has ended...\n"); sleep(1); printf("start the process, but don't wait for it.\n"); start_proc(0); return 0; } /******************************************************************************/