WinSCP.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. USEFORM("forms\CustomScpExplorer.cpp", CustomScpExplorerForm);
  5. USEFORM("forms\NonVisual.cpp", NonVisualDataModule); /* TDataModule: File Type */
  6. USEFORM("forms\ScpCommander.cpp", ScpCommanderForm);
  7. USEFORM("forms\ScpExplorer.cpp", ScpExplorerForm);
  8. USEFORM("forms\Glyphs.cpp", GlyphsModule); /* TDataModule: File Type */
  9. //---------------------------------------------------------------------------
  10. #include <CoreMain.h>
  11. #include <WinInterface.h>
  12. #include <ProgParams.h>
  13. #include <VCLCommon.h>
  14. #include <Setup.h>
  15. //---------------------------------------------------------------------------
  16. WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int)
  17. {
  18. int Result = 0;
  19. try
  20. {
  21. WinInitialize();
  22. Application->Initialize();
  23. Application->MainFormOnTaskBar = true;
  24. Application->ModalPopupMode = pmAuto;
  25. SetEnvironmentVariable(L"WINSCP_PATH",
  26. ExcludeTrailingBackslash(ExtractFilePath(Application->ExeName)).c_str());
  27. CoreInitialize();
  28. InitializeWinHelp();
  29. InitializeSystemSettings();
  30. // now everything is setup and mainly the configured locale is already loaded,
  31. // detect scaling type and possibly forbid further runtime changes to locale
  32. GUIConfiguration->DetectScalingType();
  33. try
  34. {
  35. try
  36. {
  37. ConfigureInterface();
  38. SetupInitialize();
  39. Application->Title = AppName;
  40. Result = Execute();
  41. }
  42. catch (Exception & E)
  43. {
  44. // Capture most errors before Usage class is released,
  45. // so that we can count them
  46. Configuration->Usage->Inc(L"GlobalFailures");
  47. ShowExtendedException(&E);
  48. }
  49. }
  50. __finally
  51. {
  52. FinalizeSystemSettings();
  53. FinalizeWinHelp();
  54. CoreFinalize();
  55. }
  56. }
  57. catch (Exception &E)
  58. {
  59. ShowExtendedException(&E);
  60. }
  61. return Result;
  62. }
  63. //---------------------------------------------------------------------------