extension.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #include "common.h"
  2. /* dialog messages */
  3. #define DM_FIRST 0
  4. #define DM_CLOSE DM_FIRST+1 /* A signal that the dialog is about to close */
  5. #define DM_ENABLE DM_FIRST+2
  6. #define DM_GETDLGDATA DM_FIRST+3
  7. #define DM_GETDLGBOUNDS DM_FIRST+4
  8. #define DM_GETITEMBOUNDS DM_FIRST+5
  9. #define DM_GETTEXT DM_FIRST+6 /* Retrieve the text of an edit string or the caption of an item */
  10. #define DM_KEYDOWN DM_FIRST+7
  11. #define DM_KEYUP DM_FIRST+8
  12. #define DM_SETDLGDATA DM_FIRST+9
  13. #define DM_SETFOCUS DM_FIRST+10 /* Set the keyboard focus to the given dialog item */
  14. #define DM_REDRAW DM_FIRST+11 /* Redraw the whole dialog */
  15. #define DM_SETTEXT DM_FIRST+12 /* Set a new string value for an edit line or a new caption for an item */
  16. #define DM_SETMAXTEXTLENGTH DM_FIRST+13 /* Set the maximum length of an edit string */
  17. #define DM_SHOWDIALOG DM_FIRST+14 /* Show/hide the dialog window */
  18. #define DM_SHOWITEM DM_FIRST+15 /* Show/hide a dialog item */
  19. #define DM_GETCHECK DM_FIRST+16 /* Retrieve the state of TCheckBox or TRadioButton items */
  20. #define DM_SETCHECK DM_FIRST+17 /* Change the state of TCheckBox and TRadioButton items */
  21. #define DM_LISTGETITEM DM_FIRST+18 /* Retrieve a list item */
  22. #define DM_LISTGETITEMINDEX DM_FIRST+19 /* Get current item index in a list */
  23. #define DM_LISTSETITEMINDEX DM_FIRST+20 /* Set current item index in a list */
  24. #define DM_LISTDELETE DM_FIRST+21
  25. #define DM_LISTADD DM_FIRST+22
  26. #define DM_LISTADDSTR DM_FIRST+23
  27. #define DM_LISTUPDATE DM_FIRST+24
  28. #define DM_LISTINSERT DM_FIRST+25
  29. #define DM_LISTINDEXOF DM_FIRST+26
  30. #define DM_LISTGETCOUNT DM_FIRST+27
  31. #define DM_LISTGETDATA DM_FIRST+28
  32. #define DM_LISTSETDATA DM_FIRST+29
  33. #define DM_SETDLGBOUNDS DM_FIRST+30
  34. #define DM_SETITEMBOUNDS DM_FIRST+31
  35. #define DM_GETDROPPEDDOWN DM_FIRST+32
  36. #define DM_SETDROPPEDDOWN DM_FIRST+33
  37. #define DM_GETITEMDATA DM_FIRST+34
  38. #define DM_SETITEMDATA DM_FIRST+35
  39. #define DM_LISTSET DM_FIRST+36
  40. #define DM_SETPROGRESSVALUE DM_FIRST+37
  41. #define DM_SETPROGRESSSTYLE DM_FIRST+38
  42. #define DM_SETPASSWORDCHAR DM_FIRST+39
  43. #define DM_LISTCLEAR DM_FIRST+40
  44. #define DM_TIMERSETINTERVAL DM_FIRST+41
  45. /* events messages */
  46. #define DN_FIRST 0x1000
  47. #define DN_CLICK DN_FIRST+1 /* Sent after mouse click */
  48. #define DN_DBLCLICK DN_FIRST+2 /* Sent after mouse double click */
  49. #define DN_CHANGE DN_FIRST+3 /* Sent after the dialog item is changed */
  50. #define DN_GOTFOCUS DN_FIRST+4 /* Sent when the dialog item gets input focus */
  51. #define DN_INITDIALOG DN_FIRST+5 /* Sent before showing the dialog */
  52. #define DN_KILLFOCUS DN_FIRST+6 /* Sent before a dialog item loses the input focus */
  53. #define DN_TIMER DN_FIRST+7 /* Sent when a timer expires */
  54. #define DN_KEYDOWN DM_KEYDOWN
  55. #define DN_KEYUP DM_KEYUP
  56. #define DN_CLOSE DM_CLOSE /* Sent before the dialog is closed */
  57. #define DM_USER 0x4000 /* Starting value for user defined messages */
  58. // MessageBox: To indicate the buttons displayed in the message box,
  59. // specify one of the following values.
  60. #define MB_OK 0x00000000
  61. #define MB_OKCANCEL 0x00000001
  62. #define MB_ABORTRETRYIGNORE 0x00000002
  63. #define MB_YESNOCANCEL 0x00000003
  64. #define MB_YESNO 0x00000004
  65. #define MB_RETRYCANCEL 0x00000005
  66. #define MB_ICONHAND 0x00000010
  67. #define MB_ICONQUESTION 0x00000020
  68. #define MB_ICONEXCLAMATION 0x00000030
  69. #define MB_ICONASTERICK 0x00000040
  70. #define MB_ICONWARNING MB_ICONEXCLAMATION
  71. #define MB_ICONERROR MB_ICONHAND
  72. #define MB_ICONSTOP MB_ICONHAND
  73. #define MB_ICONINFORMATION MB_ICONASTERICK
  74. // MessageBox: To indicate the default button, specify one of the following values.
  75. #define MB_DEFBUTTON1 0x00000000
  76. #define MB_DEFBUTTON2 0x00000100
  77. #define MB_DEFBUTTON3 0x00000200
  78. #define MB_DEFBUTTON4 0x00000300
  79. // MessageBox: Return values
  80. #define ID_OK 1
  81. #define ID_CANCEL 2
  82. #define ID_ABORT 3
  83. #define ID_RETRY 4
  84. #define ID_IGNORE 5
  85. #define ID_YES 6
  86. #define ID_NO 7
  87. #define ID_CLOSE 8
  88. #define ID_HELP 9
  89. /* other */
  90. #define EXT_MAX_PATH 16384 /* 16 Kb */
  91. /* Dialog window callback function */
  92. typedef intptr_t (DCPCALL *tDlgProc)(uintptr_t pDlg, char* DlgItemName, intptr_t Msg, intptr_t wParam, intptr_t lParam);
  93. /* Definition of callback functions called by the DLL */
  94. typedef BOOL (DCPCALL *tInputBoxProc)(char* Caption, char* Prompt, BOOL MaskInput, char* Value, int ValueMaxLen);
  95. typedef int (DCPCALL *tMessageBoxProc)(char* Text, char* Caption, long Flags);
  96. typedef BOOL (DCPCALL *tDialogBoxLFMProc)(intptr_t LFMData, unsigned long DataSize, tDlgProc DlgProc);
  97. typedef BOOL (DCPCALL *tDialogBoxLRSProc)(intptr_t LRSData, unsigned long DataSize, tDlgProc DlgProc);
  98. typedef BOOL (DCPCALL *tDialogBoxLFMFileProc)(char* LFMFileName, tDlgProc DlgProc);
  99. #pragma pack(push)
  100. #pragma pack(1)
  101. typedef struct {
  102. uint32_t StructSize;
  103. char PluginDir[EXT_MAX_PATH];
  104. char PluginConfDir[EXT_MAX_PATH];
  105. tInputBoxProc InputBox;
  106. tMessageBoxProc MessageBox;
  107. tDialogBoxLFMProc DialogBoxLFM;
  108. tDialogBoxLRSProc DialogBoxLRS;
  109. tDialogBoxLFMFileProc DialogBoxLFMFile;
  110. tDlgProc SendDlgMsg;
  111. unsigned char Reserved[4096 * sizeof(void *)];
  112. } tExtensionStartupInfo;
  113. #pragma pack(pop)
  114. typedef void (DCPCALL tExtensionInitializeProc)(tExtensionStartupInfo* StartupInfo);
  115. typedef void (DCPCALL tExtensionFinalizeProc)(void* Reserved);
  116. /* Plugin must implement this function for working with Extension API
  117. void DCPCALL ExtensionInitialize(tExtensionStartupInfo* StartupInfo);
  118. void DCPCALL ExtensionFinalize(void* Reserved);
  119. */