fork(1) download
  1. // runexe.cpp : 定義主控台應用程式的進入點。
  2. //
  3. #include "stdafx.h"
  4. #include <windows.h>
  5. #include <tchar.h>
  6. #include <shellapi.h>
  7.  
  8.  
  9.  
  10. int _tmain(int argc, _TCHAR* argv[])
  11. {
  12. // runexe.cpp : 定義 DLL 應用程式的匯出函式。
  13. //
  14.  
  15. SHELLEXECUTEINFO ShExecInfo = {0};
  16. ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
  17. ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
  18. ShExecInfo.hwnd = NULL;
  19. ShExecInfo.lpVerb = _T("open");
  20. ShExecInfo.lpFile = _T("C:\\Program Files\\Adobe\\Acrobat 10.0\\Acrobat\\Acrobat.exe");
  21. //ShExecInfo.lpFile = _T("C:\\AAA.exe ");
  22. ShExecInfo.lpParameters = _T(" "); //可以加參數
  23. ShExecInfo.lpDirectory = NULL;
  24. ShExecInfo.nShow = SW_HIDE;
  25. ShExecInfo.hInstApp = NULL;
  26. ShellExecuteEx(&ShExecInfo);
  27. WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
  28.  
  29. }
  30.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:20: error: stdafx.h: No such file or directory
prog.cpp:4:21: error: windows.h: No such file or directory
prog.cpp:5:19: error: tchar.h: No such file or directory
prog.cpp:6:22: error: shellapi.h: No such file or directory
prog.cpp:10: error: ‘_TCHAR’ has not been declared
prog.cpp: In function ‘int _tmain(int, int**)’:
prog.cpp:15: error: ‘SHELLEXECUTEINFO’ was not declared in this scope
prog.cpp:15: error: expected `;' before ‘ShExecInfo’
prog.cpp:16: error: ‘ShExecInfo’ was not declared in this scope
prog.cpp:17: error: ‘SEE_MASK_NOCLOSEPROCESS’ was not declared in this scope
prog.cpp:18: error: ‘NULL’ was not declared in this scope
prog.cpp:19: error: ‘_T’ was not declared in this scope
prog.cpp:24: error: ‘SW_HIDE’ was not declared in this scope
prog.cpp:26: error: ‘ShellExecuteEx’ was not declared in this scope
prog.cpp:27: error: ‘INFINITE’ was not declared in this scope
prog.cpp:27: error: ‘WaitForSingleObject’ was not declared in this scope
stdout
Standard output is empty