Tools.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 __fastcall CenterFormOn(TForm * Form, TControl * CenterOn);
  12. void __fastcall ExecuteProcessChecked(const UnicodeString & Command, UnicodeString * Output);
  13. void __fastcall ExecuteProcessCheckedAndWait(const UnicodeString & Command, UnicodeString * Output);
  14. bool __fastcall IsKeyPressed(int VirtualKey);
  15. bool __fastcall UseAlternativeFunction();
  16. bool __fastcall OpenInNewWindow();
  17. void __fastcall ExecuteNewInstance(const UnicodeString & Param);
  18. IShellLink * __fastcall CreateDesktopShortCut(const UnicodeString &Name,
  19. const UnicodeString &File, const UnicodeString & Params, const UnicodeString & Description,
  20. int SpecialFolder = -1, int IconIndex = 0, bool Return = false);
  21. IShellLink * __fastcall CreateDesktopSessionShortCut(
  22. const UnicodeString & SessionName, UnicodeString Name,
  23. const UnicodeString & AdditionalParams,
  24. int SpecialFolder = -1, int IconIndex = SITE_ICON, bool Return = false);
  25. UnicodeString __fastcall GetListViewStr(TListView * ListView);
  26. void __fastcall LoadListViewStr(TListView * ListView, UnicodeString LayoutStr);
  27. void __fastcall RestoreForm(UnicodeString Data, TForm * Form);
  28. UnicodeString __fastcall StoreForm(TCustomForm * Form);
  29. void __fastcall RestoreFormSize(UnicodeString Data, TForm * Form);
  30. UnicodeString __fastcall StoreFormSize(TForm * Form);
  31. TFontStyles __fastcall IntToFontStyles(int value);
  32. int __fastcall FontStylesToInt(const TFontStyles value);
  33. bool __fastcall SameFont(TFont * Font1, TFont * Font2);
  34. TColor __fastcall GetWindowTextColor(TColor Color);
  35. TColor __fastcall GetWindowColor(TColor Color);
  36. TColor __fastcall GetNonZeroColor(TColor Color);
  37. void __fastcall ValidateMaskEdit(TComboBox * Edit);
  38. void __fastcall ValidateMaskEdit(TEdit * Edit);
  39. void __fastcall ValidateMaskEdit(TMemo * Edit, bool Directory);
  40. bool __fastcall IsWinSCPUrl(const UnicodeString & Url);
  41. UnicodeString __fastcall SecureUrl(const UnicodeString & Url);
  42. void __fastcall OpenBrowser(UnicodeString URL);
  43. void __fastcall ShowHelp(const UnicodeString & HelpKeyword);
  44. bool __fastcall IsFormatInClipboard(unsigned int Format);
  45. bool __fastcall TextFromClipboard(UnicodeString & Text, bool Trim);
  46. bool __fastcall NonEmptyTextFromClipboard(UnicodeString & Text);
  47. HANDLE __fastcall OpenTextFromClipboard(const wchar_t *& Text);
  48. void __fastcall CloseTextFromClipboard(HANDLE Handle);
  49. void __fastcall ExitActiveControl(TForm * Form);
  50. UnicodeString __fastcall ReadResource(const UnicodeString ResName);
  51. bool __fastcall DumpResourceToFile(const UnicodeString ResName,
  52. const UnicodeString FileName);
  53. void __fastcall BrowseForExecutable(TEdit * Control, UnicodeString Title,
  54. UnicodeString Filter, bool FileNameCommand, bool Escape);
  55. void __fastcall BrowseForExecutable(TComboBox * Control, UnicodeString Title,
  56. UnicodeString Filter, bool FileNameCommand, bool Escape);
  57. bool __fastcall FontDialog(TFont * Font);
  58. bool __fastcall SaveDialog(UnicodeString Title, UnicodeString Filter,
  59. UnicodeString DefaultExt, UnicodeString & FileName);
  60. bool __fastcall AutodetectProxy(UnicodeString & HostName, int & PortNumber);
  61. bool __fastcall IsWin64();
  62. void __fastcall CopyToClipboard(UnicodeString Text);
  63. void __fastcall CopyToClipboard(TStrings * Strings);
  64. void __fastcall ShutDownWindows();
  65. void __fastcall SuspendWindows();
  66. void __fastcall EditSelectBaseName(HWND Edit);
  67. void __fastcall VerifyAndConvertKey(UnicodeString & FileName, TSshProt SshProt);
  68. void __fastcall VerifyKey(UnicodeString FileName, TSshProt SshProt);
  69. void __fastcall VerifyCertificate(const UnicodeString & FileName);
  70. TStrings * __fastcall GetUnwrappedMemoLines(TMemo * Memo);
  71. bool __fastcall DetectSystemExternalEditor(
  72. bool AllowDefaultEditor,
  73. UnicodeString & Executable, UnicodeString & ExecutableDescription,
  74. UnicodeString & UsageState, bool & TryNextTime);
  75. //---------------------------------------------------------------------------
  76. #define IUNKNOWN \
  77. virtual HRESULT __stdcall QueryInterface(const GUID& IID, void **Obj) \
  78. { \
  79. return TInterfacedObject::QueryInterface(IID, (void *)Obj); \
  80. } \
  81. \
  82. virtual ULONG __stdcall AddRef() \
  83. { \
  84. return TInterfacedObject::_AddRef(); \
  85. } \
  86. \
  87. virtual ULONG __stdcall Release() \
  88. { \
  89. return TInterfacedObject::_Release(); \
  90. }
  91. //---------------------------------------------------------------------------
  92. void __fastcall InitializeCustomHelp(ICustomHelpViewer * HelpViewer);
  93. void __fastcall FinalizeCustomHelp();
  94. //---------------------------------------------------------------------------
  95. #endif