Utils_Windows.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <Utils/Utils.h>
  9. #include <AzCore/PlatformIncl.h>
  10. namespace AtomSampleViewer
  11. {
  12. namespace Utils
  13. {
  14. bool SupportsResizeClientArea()
  15. {
  16. return true;
  17. }
  18. bool RunDiffTool(const AZStd::string& filePathA, const AZStd::string& filePathB)
  19. {
  20. bool result = false;
  21. AZStd::wstring exeW = L"C:\\Program Files\\Beyond Compare 4\\BCompare.exe";
  22. AZStd::wstring filePathAW;
  23. AZStd::to_wstring(filePathAW, filePathA.c_str());
  24. AZStd::wstring filePathBW;
  25. AZStd::to_wstring(filePathBW, filePathB.c_str());
  26. AZStd::wstring commandLineW = L"\"" + exeW + L"\" \"" + filePathAW + L"\" \"" + filePathBW + L"\"";
  27. STARTUPINFOW si;
  28. PROCESS_INFORMATION pi;
  29. ZeroMemory(&si, sizeof(si));
  30. si.cb = sizeof(si);
  31. ZeroMemory(&pi, sizeof(pi));
  32. // start the program up
  33. result = CreateProcessW(exeW.data(), // the path
  34. commandLineW.data(), // Command line
  35. NULL, // Process handle not inheritable
  36. NULL, // Thread handle not inheritable
  37. FALSE, // Set handle inheritance to FALSE
  38. 0, // No creation flags
  39. NULL, // Use parent's environment block
  40. NULL, // Use parent's starting directory
  41. &si, // Pointer to STARTUPINFO structure
  42. &pi // Pointer to PROCESS_INFORMATION structure (removed extra parentheses)
  43. );
  44. // Close process and thread handles.
  45. CloseHandle(pi.hProcess);
  46. CloseHandle(pi.hThread);
  47. return result;
  48. }
  49. } // namespace Utils
  50. } // namespace AtomSampleViewer