Tools.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //---------------------------------------------------------------------------
  2. #ifndef ToolsH
  3. #define ToolsH
  4. #include <ComCtrls.hpp>
  5. #include <WinInterface.h>
  6. #include <HelpIntfs.hpp>
  7. #include <stdio.h>
  8. #include <SessionData.h>
  9. #include <Vcl.Graphics.hpp>
  10. //---------------------------------------------------------------------------
  11. void ExecuteProcessAndReadOutput(const UnicodeString & Command, UnicodeString & Output, DWORD & ExitCode, bool ReadStdErr);
  12. void __fastcall ExecuteProcessChecked(
  13. const UnicodeString & Command, const UnicodeString & HelpKeyword, UnicodeString * Output);
  14. void __fastcall ExecuteProcessCheckedAndWait(
  15. const UnicodeString & Command, const UnicodeString & HelpKeyword, UnicodeString * Output);
  16. bool __fastcall IsKeyPressed(int VirtualKey);
  17. bool __fastcall UseAlternativeFunction();
  18. bool __fastcall OpenInNewWindow();
  19. void ExecuteSelf(const UnicodeString & Params);
  20. void __fastcall ExecuteNewInstance(const UnicodeString & Param, const UnicodeString & AdditionalParams = UnicodeString());
  21. UnicodeString GetIniFileParam();
  22. IShellLink * __fastcall CreateAppDesktopShortCut(
  23. const UnicodeString & Name, const UnicodeString & Params, const UnicodeString & Description,
  24. int SpecialFolder = -1, int IconIndex = 0, bool Return = false);
  25. IShellLink * __fastcall CreateDesktopSessionShortCut(
  26. const UnicodeString & SessionName, UnicodeString Name,
  27. const UnicodeString & AdditionalParams,
  28. int SpecialFolder = -1, int IconIndex = SITE_ICON, bool Return = false);
  29. UnicodeString __fastcall GetListViewStr(TCustomListView * ListView);
  30. void __fastcall LoadListViewStr(TCustomListView * ListView, UnicodeString LayoutStr);
  31. void RestoreForm(const UnicodeString & Data, TForm * Form, bool PositionOnly = false, const UnicodeString & DefaultData = EmptyStr);
  32. UnicodeString __fastcall StoreForm(TForm * Form);
  33. void __fastcall RestoreFormSize(UnicodeString Data, TForm * Form);
  34. UnicodeString __fastcall StoreFormSize(TForm * Form);
  35. TFontStyles __fastcall IntToFontStyles(int value);
  36. int __fastcall FontStylesToInt(const TFontStyles value);
  37. bool __fastcall SameFont(TFont * Font1, TFont * Font2);
  38. TColor __fastcall GetWindowTextColor(TColor BackgroundColor, TColor Color = static_cast<TColor>(0));
  39. TColor __fastcall GetWindowColor(TColor Color = static_cast<TColor>(0));
  40. TColor __fastcall GetBtnFaceColor();
  41. TColor GetLightLinkColor();
  42. TColor GetLinkColor(TControl * Control);
  43. TColor __fastcall GetNonZeroColor(TColor Color);
  44. void ValidateMask(const UnicodeString & Mask, int ForceDirectoryMasks = -1);
  45. void __fastcall ValidateMaskEdit(TComboBox * Edit);
  46. void __fastcall ValidateMaskEdit(TEdit * Edit);
  47. void __fastcall ValidateMaskEdit(TMemo * Edit, bool Directory);
  48. bool __fastcall IsWinSCPUrl(const UnicodeString & Url);
  49. UnicodeString __fastcall SecureUrl(const UnicodeString & Url);
  50. void __fastcall OpenBrowser(UnicodeString URL);
  51. void __fastcall OpenFileInExplorer(const UnicodeString & Path);
  52. void __fastcall OpenFolderInExplorer(const UnicodeString & Path);
  53. void __fastcall ShowHelp(const UnicodeString & HelpKeyword);
  54. bool __fastcall IsFormatInClipboard(unsigned int Format);
  55. bool __fastcall NonEmptyTextFromClipboard(UnicodeString & Text);
  56. HANDLE __fastcall OpenTextFromClipboard(const wchar_t *& Text);
  57. void __fastcall CloseTextFromClipboard(HANDLE Handle);
  58. void __fastcall ExitActiveControl(TForm * Form);
  59. UnicodeString __fastcall ReadResource(const UnicodeString ResName);
  60. bool __fastcall DumpResourceToFile(const UnicodeString ResName,
  61. const UnicodeString FileName);
  62. void __fastcall BrowseForExecutable(TEdit * Control, UnicodeString Title,
  63. UnicodeString Filter, bool FileNameCommand, bool Escape);
  64. void __fastcall BrowseForExecutable(TComboBox * Control, UnicodeString Title,
  65. UnicodeString Filter, bool FileNameCommand, bool Escape);
  66. bool __fastcall FontDialog(TFont * Font);
  67. bool __fastcall SaveDialog(UnicodeString Title, UnicodeString Filter,
  68. UnicodeString DefaultExt, UnicodeString & FileName);
  69. bool __fastcall AutodetectProxy(UnicodeString & HostName, int & PortNumber);
  70. void __fastcall CopyToClipboard(UnicodeString Text);
  71. void __fastcall CopyToClipboard(TStrings * Strings);
  72. void __fastcall ShutDownWindows();
  73. void __fastcall SuspendWindows();
  74. void __fastcall EditSelectBaseName(HWND Edit);
  75. UnicodeString GetConvertedKeyFileName(const UnicodeString & FileName);
  76. struct TPrivateKey;
  77. UnicodeString AddMatchingKeyCertificate(TPrivateKey * PrivateKey, const UnicodeString & FileName);
  78. void __fastcall VerifyAndConvertKey(UnicodeString & FileName, bool CanIgnore);
  79. void __fastcall VerifyKey(const UnicodeString & FileName);
  80. void __fastcall VerifyCertificate(const UnicodeString & FileName);
  81. TStrings * __fastcall GetUnwrappedMemoLines(TMemo * Memo);
  82. bool __fastcall DetectSystemExternalEditor(
  83. bool AllowDefaultEditor,
  84. UnicodeString & Executable, UnicodeString & ExecutableDescription,
  85. UnicodeString & UsageState, bool & TryNextTime);
  86. //---------------------------------------------------------------------------
  87. #define IUNKNOWN \
  88. virtual HRESULT __stdcall QueryInterface(const GUID& IID, void **Obj) \
  89. { \
  90. return TInterfacedObject::QueryInterface(IID, (void *)Obj); \
  91. } \
  92. \
  93. virtual ULONG __stdcall AddRef() \
  94. { \
  95. return TInterfacedObject::_AddRef(); \
  96. } \
  97. \
  98. virtual ULONG __stdcall Release() \
  99. { \
  100. return TInterfacedObject::_Release(); \
  101. }
  102. //---------------------------------------------------------------------------
  103. void __fastcall InitializeCustomHelp(ICustomHelpViewer * HelpViewer);
  104. void __fastcall FinalizeCustomHelp();
  105. //---------------------------------------------------------------------------
  106. #endif