extension.pas 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. unit Extension;
  2. interface
  3. const
  4. // dialog messages
  5. DM_FIRST = 0;
  6. DM_CLOSE = DM_FIRST+1; // A signal that the dialog is about to close
  7. DM_ENABLE = DM_FIRST+2;
  8. DM_GETDLGDATA = DM_FIRST+3;
  9. DM_GETDLGBOUNDS = DM_FIRST+4;
  10. DM_GETITEMBOUNDS = DM_FIRST+5;
  11. DM_GETTEXT = DM_FIRST+6; // Retrieve the text of an edit string or the caption of an item
  12. DM_KEYDOWN = DM_FIRST+7;
  13. DM_KEYUP = DM_FIRST+8;
  14. DM_SETDLGDATA = DM_FIRST+9;
  15. DM_SETFOCUS = DM_FIRST+10; // Set the keyboard focus to the given dialog item
  16. DM_REDRAW = DM_FIRST+11; // Redraw the whole dialog
  17. DM_SETTEXT = DM_FIRST+12; // Set a new string value for an edit line or a new caption for an item
  18. DM_SETMAXTEXTLENGTH = DM_FIRST+13; // Set the maximum length of an edit string
  19. DM_SHOWDIALOG = DM_FIRST+14; // Show/hide the dialog window
  20. DM_SHOWITEM = DM_FIRST+15; // Show/hide a dialog item
  21. DM_GETCHECK = DM_FIRST+16; // Retrieve the state of TCheckBox or TRadioButton items
  22. DM_SETCHECK = DM_FIRST+17; // Change the state of TCheckBox and TRadioButton items
  23. DM_LISTGETITEM = DM_FIRST+18; // Retrieve a list item
  24. DM_LISTGETITEMINDEX = DM_FIRST+19; // Get current item index in a list
  25. DM_LISTSETITEMINDEX = DM_FIRST+20; // Set current item index in a list
  26. DM_LISTDELETE = DM_FIRST+21;
  27. DM_LISTADD = DM_FIRST+22;
  28. DM_LISTADDSTR = DM_FIRST+23;
  29. DM_LISTUPDATE = DM_FIRST+24;
  30. DM_LISTINSERT = DM_FIRST+25;
  31. DM_LISTINDEXOF = DM_FIRST+26;
  32. DM_LISTGETCOUNT = DM_FIRST+27;
  33. DM_LISTGETDATA = DM_FIRST+28;
  34. DM_LISTSETDATA = DM_FIRST+29;
  35. DM_SETDLGBOUNDS = DM_FIRST+30;
  36. DM_SETITEMBOUNDS = DM_FIRST+31;
  37. DM_GETDROPPEDDOWN = DM_FIRST+32;
  38. DM_SETDROPPEDDOWN = DM_FIRST+33;
  39. DM_GETITEMDATA = DM_FIRST+34;
  40. DM_SETITEMDATA = DM_FIRST+35;
  41. DM_LISTSET = DM_FIRST+36;
  42. DM_SETPROGRESSVALUE = DM_FIRST+37;
  43. DM_SETPROGRESSSTYLE = DM_FIRST+38;
  44. DM_SETPASSWORDCHAR = DM_FIRST+39;
  45. DM_LISTCLEAR = DM_FIRST+40;
  46. DM_TIMERSETINTERVAL = DM_FIRST+41;
  47. // events messages
  48. DN_FIRST = $1000;
  49. DN_CLICK = DN_FIRST+1; // Sent after mouse click
  50. DN_DBLCLICK = DN_FIRST+2; // Sent after mouse double click
  51. DN_CHANGE = DN_FIRST+3; // Sent after the dialog item is changed
  52. DN_GOTFOCUS = DN_FIRST+4; // Sent when the dialog item gets input focus
  53. DN_INITDIALOG = DN_FIRST+5; // Sent before showing the dialog
  54. DN_KILLFOCUS = DN_FIRST+6; // Sent before a dialog item loses the input focus
  55. DN_TIMER = DN_FIRST+7; // Sent when a timer expires
  56. DN_KEYDOWN = DM_KEYDOWN;
  57. DN_KEYUP = DM_KEYUP;
  58. DN_CLOSE = DM_CLOSE; // Sent before the dialog is closed
  59. DM_USER = $4000; // Starting value for user defined messages
  60. const
  61. // MessageBox: To indicate the buttons displayed in the message box,
  62. // specify one of the following values.
  63. MB_OK = $00000000;
  64. MB_OKCANCEL = $00000001;
  65. MB_ABORTRETRYIGNORE = $00000002;
  66. MB_YESNOCANCEL = $00000003;
  67. MB_YESNO = $00000004;
  68. MB_RETRYCANCEL = $00000005;
  69. MB_ICONHAND = $00000010;
  70. MB_ICONQUESTION = $00000020;
  71. MB_ICONEXCLAMATION = $00000030;
  72. MB_ICONASTERICK = $00000040;
  73. MB_ICONWARNING = MB_ICONEXCLAMATION;
  74. MB_ICONERROR = MB_ICONHAND;
  75. MB_ICONSTOP = MB_ICONHAND;
  76. MB_ICONINFORMATION = MB_ICONASTERICK;
  77. // MessageBox: To indicate the default button, specify one of the following values.
  78. MB_DEFBUTTON1 = $00000000;
  79. MB_DEFBUTTON2 = $00000100;
  80. MB_DEFBUTTON3 = $00000200;
  81. MB_DEFBUTTON4 = $00000300;
  82. // MessageBox: Return values
  83. ID_OK = 1;
  84. ID_CANCEL = 2;
  85. ID_ABORT = 3;
  86. ID_RETRY = 4;
  87. ID_IGNORE = 5;
  88. ID_YES = 6;
  89. ID_NO = 7;
  90. ID_CLOSE = 8;
  91. ID_HELP = 9;
  92. const
  93. EXT_MAX_PATH = 16384; // 16 Kb
  94. { For compatibility with Delphi use $IFDEF's to set calling convention }
  95. type
  96. { Dialog window callback function }
  97. TDlgProc = function(pDlg: PtrUInt; DlgItemName: PAnsiChar; Msg, wParam, lParam: PtrInt): PtrInt; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
  98. { Definition of callback functions called by the DLL }
  99. TInputBoxProc = function(Caption, Prompt: PAnsiChar; MaskInput: LongBool; Value: PAnsiChar; ValueMaxLen: Integer): LongBool; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
  100. TMessageBoxProc = function(Text, Caption: PAnsiChar; Flags: Longint): Integer; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
  101. TDialogBoxLFMProc = function(LFMData: Pointer; DataSize: LongWord; DlgProc: TDlgProc): LongBool; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
  102. TDialogBoxLRSProc = function(LRSData: Pointer; DataSize: LongWord; DlgProc: TDlgProc): LongBool; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
  103. TDialogBoxLFMFileProc = function(lfmFileName: PAnsiChar; DlgProc: TDlgProc): LongBool; {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
  104. type
  105. PExtensionStartupInfo = ^TExtensionStartupInfo;
  106. TExtensionStartupInfo = packed record
  107. // The size of the structure, in bytes
  108. StructSize: LongWord;
  109. // Directory where plugin is located (UTF-8 encoded)
  110. PluginDir: packed array [0..Pred(EXT_MAX_PATH)] of AnsiChar;
  111. // Directory where plugin configuration file must be located (UTF-8 encoded)
  112. PluginConfDir: packed array [0..Pred(EXT_MAX_PATH)] of AnsiChar;
  113. // Dialog API
  114. InputBox: TInputBoxProc;
  115. MessageBox: TMessageBoxProc;
  116. DialogBoxLFM: TDialogBoxLFMProc;
  117. DialogBoxLRS: TDialogBoxLRSProc;
  118. DialogBoxLFMFile: TDialogBoxLFMFileProc;
  119. SendDlgMsg: TDlgProc;
  120. // Reserved for future API extension
  121. Reserved: packed array [0..Pred(4096 * SizeOf(Pointer))] of Byte;
  122. end;
  123. type
  124. TExtensionInitializeProc = procedure(StartupInfo: PExtensionStartupInfo); {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
  125. TExtensionFinalizeProc = procedure(Reserved: Pointer); {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
  126. implementation
  127. (* Plugin must implement this function for working with Extension API
  128. procedure ExtensionInitialize(StartupInfo: PExtensionStartupInfo); {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
  129. procedure ExtensionFinalize(Reserved: Pointer); {$IFDEF MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF};
  130. *)
  131. end.