stdafx.cpp 889 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // stdafx.cpp : 只包括标准包含文件的源文件
  2. // RvcWindowsInitial.pch 将作为预编译头
  3. // stdafx.obj 将包含预编译类型信息
  4. #include "stdafx.h"
  5. // TODO: 在 STDAFX.H 中
  6. // 引用任何所需的附加头文件,而不是在此文件中引用
  7. UINT SYSTEM_ON(CStringA cmdLine)
  8. {
  9. UINT result = 0;
  10. CStringA strCmd;
  11. strCmd.Format("cmd /c %s", cmdLine);
  12. #if 0
  13. result = system(strCmd.GetBuffer());
  14. return result;
  15. #else
  16. result = WinExec(strCmd, SW_HIDE);
  17. return result > 31 ? ERROR_SUCCESS : result + 31;
  18. #endif
  19. }
  20. UINT SYSTEM_ON(CStringW cmdLine)
  21. {
  22. UINT result = 0;
  23. CStringW strCmd;
  24. strCmd.Format(L"cmd /c %s", cmdLine);
  25. char tempCmd[2048];
  26. CStringToMultiByteW(strCmd, tempCmd, strCmd.GetLength() + 1);
  27. #if 0
  28. result = system(tempCmd);
  29. return result;
  30. #else
  31. result = WinExec(tempCmd, SW_HIDE);
  32. return result > 31 ? ERROR_SUCCESS : result + 31;
  33. #endif
  34. }