Tools.h 4.9 KB

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