home *** CD-ROM | disk | FTP | other *** search
/ PC Loisirs 18 / cd.iso / kit / mail / pmail.exe / forms / wpmforms.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-26  |  52.9 KB  |  1,051 lines

  1. //
  2. //  WPMFORMS.H
  3. //  Definitions and constants for the Pegasus Mail for Windows
  4. //  Extensions Manager interface.
  5. //
  6. //  Copyright (c) 1994-95, David Harris, all rights reserved.
  7. //
  8.  
  9. //  Next available offset -
  10. //    -  For WM_FM_*      =   10    (22 Jan '95)
  11. //    -  For WM_F_*       =   67    (26 Apr '95)
  12.  
  13. //  Flag constants:
  14.  
  15. #define WPM_STARTUP     1     // Extension wants to be loaded at startup
  16. #define WPM_NOLIST      2     // Do not show extension in Form Manager list
  17. #define WPM_HIDDEN      4     // Do not display extension's parent window
  18. #define WPM_LOGGING     8     // Extension wants to receive logging events
  19. #define WPM_ONEONLY     16    // Disallow multiple simultaneous instances
  20.  
  21. #define WPM_PROHIBIT    0x9999L
  22.  
  23. //  Form dialogs and callbacks: a form DLL can export a function
  24. //  which WinPMail's form manager will call with Windows messages
  25. //  destined for the form's dialog or window (such as menu selections
  26. //  and so forth). The function takes the following form:
  27.  
  28. typedef long FAR PASCAL (*FORM_CALLBACK) (HWND hWnd, WORD wMsg,
  29.    WPARAM wParam, LPARAM lParam);
  30.  
  31. //  The return from a form callback is passed back through the
  32. //  Windows call chain if non-zero, otherwise the default window
  33. //  proc is called.
  34.  
  35. //  Minimum interface: the minimum interface a form DLL must provide
  36. //  is a routine called "FORMINIT" which is exported by name. "FORMINIT"
  37. //  has the following prototype:
  38.  
  39. typedef WORD FAR PASCAL (*FN_FORMINIT) (WORD version, int variant, 
  40.    HWND hParent, char *data, HWND *hDialog, char *callback_name);
  41.  
  42. //  "version" is passed in with the version of the WinPMail forms
  43. //     manager which is running.
  44. //  "variant" indicates what type of form is required - the following
  45. //     values are currently defined:
  46. //       0: Create a form for composing a message
  47. //       1: Create a form for reading a message
  48. //  "hParent" contains the handle of the WinPMail MDI child window
  49. //     which is to contain the form.
  50. //  "data" contains any string defined as being required for the
  51. //     form in the menu interface.
  52. //  "hDialog" should be filled in with the window handle of the
  53. //     modeless dialog created within the MDI child window. If the
  54. //     value returned is NULL, then the MDI child window will be
  55. //     hidden and will never actually interact directly with the
  56. //     user, but the extension will still receive messages from the
  57. //     Form Manager and can still send messages to its parent for
  58. //     access to API functions.
  59. //  "callback_name" (optional) should be filled in with the name of the
  60. //     function in the DLL of the exported function to which messages
  61. //     should be sent or NULL if there is none. If NULL, messages are
  62. //     sent to the dialog returned in "hDialog". You will use an
  63. //     indirect callback of this kind when your extension does not
  64. //     create a dialog within the enclosing parent window.
  65. //
  66. //  When FORMINIT is called, the DLL should create the dialog within
  67. //  the MDI parent window and set it to the correct size. On return
  68. //  WinPMail will resize the parent window to enclose the dialog
  69. //  correctly. The DLL should NOT make the dialog visible - WinPMail
  70. //  will do that as required.
  71.  
  72. //
  73. // +--------------------------------------------------------------------+
  74. // |  SECTION 1:                                                        |
  75. // |  Messages the Extension Manager can send to an extension:          |
  76. // +--------------------------------------------------------------------+
  77. //
  78.  
  79. #define WM_FM_FORMBASE           (WM_USER + 1800)
  80.  
  81. //  Sent by the manager after the MDI parent window has been created
  82. //  and FORMINIT has been called, but before any positioning has been
  83. //  done. At the time this message arrives, the window will not be
  84. //  visible on the screen. An extension may send any extension manager
  85. //  message while processing this message and at any time afterwards.
  86. #define WM_FM_INIT               (WM_FM_FORMBASE + 1)
  87.  
  88. //  Sent by the manager when the enclosing MDI window is resized.
  89. //  The parameters from the WM_SIZE message passed by windows are
  90. //  sent through unaltered. If an extension contains a dialog, it
  91. //  should resize the dialog to the MDI parent window size in
  92. //  response to this message.
  93. #define WM_FM_SIZE               (WM_FM_FORMBASE + 2)
  94.  
  95. //  Sent by the manager when Windows asks it for the limits on a
  96. //  window resize operation. See the Windows documentation for
  97. //  WM_GETMINMAXINFO for more details (the manager passes the
  98. //  parameters through unmodified).
  99. #define WM_FM_GETMINMAXINFO      (WM_FM_FORMBASE + 3)
  100.  
  101. //  Sent by the forms manager after creating the form dialog but before
  102. //  displaying the MDI child window; asks where the form would like its
  103. //  window placed on the screen. lParam points to a POINT structure;
  104. //  if 1 is returned, the position it contains will be used. The position
  105. //  should be expressed in units from the top left corner of WinPMail's
  106. //  main client area. If 0 is returned, WinPMail will stagger the window
  107. //  like any other of its own windows. If 2 is returned, WinPMail will
  108. //  centre the window in the client area.
  109. #define WM_FM_WHEREYAWANNIT       (WM_FM_FORMBASE + 4)
  110.  
  111. //  Sent by the manager at the end of Window creation, after the
  112. //  window has been made visible. The dialog should set focus to
  113. //  whichever control it wishes.
  114. #define WM_FM_INITFOCUS           (WM_FM_FORMBASE + 5)
  115.  
  116. //  Sent by the manager any time the window should restore its
  117. //  focus to the last active control. This curiosity is needed
  118. //  because of a glitch in the way Windows handles focus for
  119. //  dialogs embedded in MDI children. Dialogs should record the
  120. //  last active control by trapping EN_SETFOCUS messages from
  121. //  the controls they contain.
  122. #define WM_FM_RESTOREFOCUS        (WM_FM_FORMBASE + 6)
  123.  
  124. //  The Manager generates a WM_FM_COMMAND message any time it
  125. //  receives a WM_COMMAND message which it cannot itself handle.
  126. //  In almost all cases, this will occur with menu selections
  127. //  from the main WinPMail menu. The format of this command is
  128. //  exactly the same as a WM_COMMAND message.
  129. #define WM_FM_COMMAND             (WM_FM_FORMBASE + 7)
  130.  
  131. //  The following predefined values should be used to decode
  132. //  WM_FM_COMMAND messages: you should avoid using any of these
  133. //  values in any menu you create.
  134. #define IDM_PRINT            107      //  Print the current contents
  135. #define IDM_UNDO             131      //  User selected "undo"
  136. #define IDM_CUT              132      //  User selected "cut"
  137. #define IDM_COPY             133      //  User selected "copy"
  138. #define IDM_PASTE            134      //  User selected "paste"
  139. #define IDM_CLEAR            135      //  User selected "clear"
  140. #define IDM_SELECTALL        136      //  User selected "select all"
  141. #define IDM_SPELLING         137      //  User asked to check spelling
  142. #define IDM_TODISK           230      //  User clicked the "to disk" bp icon
  143. #define IDM_FROMDISK         231      //  User clicked the "from disk" bp icon
  144. #define IDM_FONT             299      //  User clicked the "font" bp icon
  145.  
  146. //
  147. // +--------------------------------------------------------------------+
  148. // |  SECTION 2:                                                        |
  149. // |  Messages a form can send to the Forms Manager to access           |
  150. // |  internal Pegasus Mail messaging services:                         |
  151. // +--------------------------------------------------------------------+
  152. //
  153.  
  154. #define WM_F_FORMBASE            (WM_USER + 2000)
  155.  
  156. //  Open the Recent address list and allow the user to select
  157. //  addresses from it. Any addresses selected are pasted into the
  158. //  EDIT control specified in wParam.
  159. //  ** PARAMETERS: wParam = Active edit control;  lParam = unused
  160. //  ** RETURNS:    Nothing
  161. #define WM_F_QUICKADDRESS        (WM_F_FORMBASE + 1)
  162.  
  163. //  Create a new message ready to be filled out. NOTE: this does not
  164. //  mean "open a new mail composition window", it merely means "I am
  165. //  about to generate a message for you to send - get ready", and
  166. //  causes the Extension Manager to create internal data structures.
  167. //  Note that this function will also "reset" the message structure
  168. //  associated with an extension window if a message has already been
  169. //  started or sent, clearing all addresses, custom headers and other
  170. //  defined fields.
  171. //  ** PARAMETERS: None
  172. //  ** RETURNS:    1 on success, 0 on failure (out of memory)
  173. //  ** WARNING:    You MUST send this message before attempting to
  174. //                 fill out any fields in a message.
  175. #define WM_F_NEWMESSAGE          (WM_F_FORMBASE + 2)
  176.  
  177. //  Set the "To" field of the message
  178. //  ** PARAMETERS: wParam = unused; lParam = address to set
  179. //  ** RETURNS:    Nothing
  180. #define WM_F_TO                  (WM_F_FORMBASE + 3)
  181.  
  182. //  Set the "Cc" field of the message
  183. //  ** PARAMETERS: wParam = unused; lParam = address to set
  184. //  ** RETURNS:    Nothing
  185. #define WM_F_CC                  (WM_F_FORMBASE + 4)
  186.  
  187. //  Set the "BCc" field of the message
  188. //  ** PARAMETERS: wParam = unused; lParam = address to set
  189. //  ** RETURNS:    Nothing
  190. #define WM_F_BCC                 (WM_F_FORMBASE + 5)
  191.  
  192. //  Set the "Subject" field of the message
  193. //  ** PARAMETERS: wParam = unused; lParam = text to set
  194. //  ** RETURNS:    Nothing
  195. #define WM_F_SUBJECT             (WM_F_FORMBASE + 6)
  196.  
  197. //  Set the message's Copy-to-self flag
  198. //  ** PARAMETERS: wParam = 1 or 0; lParam = unused
  199. //  ** RETURNS:    Nothing
  200. #define WM_F_COPYSELF            (WM_F_FORMBASE + 7)
  201.  
  202. //  Set the message's Confirm-reading flag
  203. //  ** PARAMETERS: wParam = 1 or 0; lParam = unused
  204. //  ** RETURNS:    Nothing
  205. #define WM_F_CONFIRMREADING      (WM_F_FORMBASE + 8)
  206.  
  207. //  Set the message's Confirm-delivery flag
  208. //  ** PARAMETERS: wParam = 1 or 0; lParam = unused
  209. //  ** RETURNS:    Nothing
  210. #define WM_F_CONFIRMDELIVERY     (WM_F_FORMBASE + 9)
  211.  
  212. //  Set the message's Urgent flag
  213. //  ** PARAMETERS: wParam = 1 or 0; lParam = unused
  214. //  ** RETURNS:    Nothing
  215. #define WM_F_URGENT              (WM_F_FORMBASE + 10)
  216.  
  217. //  Set the message's Use-MIME flag
  218. //  ** PARAMETERS: wParam = 1 (use MIME) or 0 (Don't); lParam = unused
  219. //  ** RETURNS:    Nothing
  220. #define WM_F_MIME                (WM_F_FORMBASE + 11)
  221.  
  222. //  Set/unset the flag which controls whether or not a message
  223. //  can be sent via Internet transports using raw 8-bit data.
  224. //  ** PARAMETERS: wParam = 1 (allow 8 bits) or 0 (don't); lParam = unused
  225. //  ** RETURNS:    Nothing
  226. //  Note: 8-bit data is officially illegal in Internet mail - you are
  227. //    <<strongly>> urged not to use this option unless you have no other
  228. //    choice and understand very clearly what you are doing. The author
  229. //    accepts no responsibility whatsoever for abuse of this feature and
  230. //    reserves the right to remove or disable it in future releases of
  231. //    the program if it is indiscriminately or carelessly used.
  232. #define WM_F_8BITDATA            (WM_F_FORMBASE + 62)
  233.  
  234. //  Set the "Reply-to" field of the message
  235. //  ** PARAMETERS: wParam = unused; lParam = address to set
  236. //  ** RETURNS:    Nothing
  237. #define WM_F_REPLYTO             (WM_F_FORMBASE + 12)
  238.  
  239. //  Add an attachment to the message:
  240. //  ** PARAMETERS: wParam = unused;
  241. //     lParam points to a record of the following type:
  242. #ifndef WINPMAIL
  243. typedef struct
  244.    {
  245.    char file_to_attach [144];
  246.    char attachment_type [32];
  247.    char encoding;
  248.    } ATTACHMENT;
  249. #endif
  250. //  "encoding" can be:
  251. //     0: Best guess - WinPMail chooses the most appropriate encoding
  252. //     1: No encoding (use with EXTREME care)
  253. //     2: ASCII text
  254. //     3: UUencoding
  255. //     4: BinHex
  256. //     5: MIME encoding (BASE64)
  257. //  You are <<strongly>> encouraged to set "encoding" to 0 unless you
  258. //  are VERY sure of what you are doing.
  259. //  ** RETURNS:    Nothing
  260. #define WM_F_ATTACH              (WM_F_FORMBASE + 13)
  261.  
  262. //  Set the encryption key for the message; if 0-length, the message
  263. //  is not encrypted.
  264. //  ** PARAMETERS: wParam = unused; lParam points to encryption key
  265. //  ** RETURNS:    Nothing
  266. #define WM_F_ENCRYPTIONKEY       (WM_F_FORMBASE + 14)
  267.  
  268. //  Set the message's No-signature flag; wParam = 1 or 0
  269. //  ** PARAMETERS: wParam = 1 (no signature) or 0; lParam = unused
  270. //  ** RETURNS:    Nothing
  271. //  ** Note the reversed sense of the wParam parameter.
  272. #define WM_F_NOSIG               (WM_F_FORMBASE + 15)
  273.  
  274. //  Indicate the full path to a file containing the text Pegasus Mail
  275. //  should use as the body of the mail message.
  276. //  ** PARAMETERS: wParam = unused; lParam = pointer to path (C string)
  277. //  ** RETURNS:    Nothing
  278. //  ** Note: this message and WM_F_MESSAGETEXT are mutually exclusive.
  279. //  ** Note 2: the variable pointed to by lParam should be persistent -
  280. //     that is, its value should remain valid until the message is sent.
  281. //     Pegasus Mail stores the pointer, not a copy of the data, so if you
  282. //     allocate the path on the stack the return from the function where
  283. //     it is declared, it will be trashed. In general, either allocate
  284. //     memory for it explicitly or declare it static. If you allocate
  285. //     memory for it, remember to release it, since WinPMail will not.
  286. #define WM_F_MESSAGEFILE         (WM_F_FORMBASE + 16)
  287.  
  288. //  Set the text of the mail message body to a block contained in memory.
  289. //  Lines should end in LF characters only. lParam points to the text,
  290. //  which must be nul-terminated.
  291. //  ** PARAMETERS: wParam = unused; lParam = pointer to textual data.
  292. //  ** RETURNS:    Nothing
  293. //  ** Note: this message and WM_F_MESSAGEFILE are mutually exclusive.
  294. //  ** Note 2: you can get text from an edit control formatted in the
  295. //     proper way for this message using the WM_F_GETTEXT message.
  296. #define WM_F_MESSAGETEXT         (WM_F_FORMBASE + 17)
  297.  
  298. //  Set the expiration date of the message
  299. //  ** PARAMETERS: wParam = unused; lParam = pointer to a 7-byte
  300. //     date format record described under WM_F_GETDATETIME below.
  301. //  ** RETURNS:    Nothing
  302. #define WM_F_EXPIRATION          (WM_F_FORMBASE + 18)
  303.  
  304. //  Initialize a message created using the WM_F_NEWMESSAGE menu to
  305. //  the values stored in the user's preferences file. You should send
  306. //  this message after sending WM_F_NEWMESSAGE but before sending any
  307. //  other messagefield-related message.
  308. //  ** PARAMETERS: wParam = unused; lParam = unused
  309. //  ** RETURNS:    Nothing
  310. #define WM_F_SETDEFAULTS         (WM_F_FORMBASE + 19)
  311.  
  312. //  Set a custom header in the outgoing message. lParam points to
  313. //  the header data, and wParam is either 0 if the header is suitable
  314. //  for use in RFC822 messages or 1 if the header is intended for use
  315. //  in MHS messages. This routine cannot be used to alter the following
  316. //  headers in the message: "From:", "To:", "Reply-to:", "Cc:", "Bcc:",
  317. //  "Subject:", "Date:", "X-To:", "Copies-to:", "Organization:",
  318. //  "Priority:", "Importance:", or "Sender:" - attempting to do so will
  319. //  return an error code. Any other legally formatted header may be
  320. //  added, though; the header may contain LFs to indicate line breaks
  321. //  (note, do NOT add the CR) but must follow proper line folding rules
  322. //  for the destination transport. The header need not end with a newline
  323. //  character but may (WinPMail will add it if necessary).
  324. //  ** PARAMETERS: wParam = 0 (RFC822) or 1 (MHS); lParam = header.
  325. //  ** RETURNS:    1=Success, 0=illegal header, -1 = out of memory.
  326. //  ** WARNING:    This message is extremely specialised and should not
  327. //                 be needed in the vast majority of cases. You should
  328. //                 only use this message if you have expert knowledge
  329. //                 of the message transport for with the header you are
  330. //                 adding is intended.
  331. #define WM_F_SETHEADER           (WM_F_FORMBASE + 61)
  332.  
  333. //  Send a message created using the interface defined in the
  334. //  preceding messages. It is legal to call this message repeatedly
  335. //  for the same message definition - so, if you wanted to send the
  336. //  same message to 20 different users, you could set it up the way
  337. //  you want it then call WM_F_TO after each WM_F_SENDMESSAGE call
  338. //  to change the recipient.
  339. //  ** PARAMETERS: wParam = unused; lParam = unused
  340. //  ** RETURNS:    0 on failure, 1 on success.
  341. #define WM_F_SENDMESSAGE         (WM_F_FORMBASE + 20)
  342.  
  343. //
  344. // +--------------------------------------------------------------------+
  345. // |  Section 3:                                                        |
  346. // |  Simple TCP/IP interface routines                                  |
  347. // +--------------------------------------------------------------------+
  348. //
  349. // The extensions manager provides a simplified TCP/IP interface to
  350. // extensions, suitable for simple question-and-answer style protocols
  351. // such as POP3, SMTP, Finger, LDAP or PH. The TCP/IP connection is
  352. // fully buffered and quite robust, but offers nothing fancy. An
  353. // extension can have up to five TCP/IP connections open at any time.
  354. // If you need more than this interface offers (UDP support, for
  355. // instance), you should load WINSOCK.DLL using your own instance
  356. // handle and access its services directly.
  357. //
  358. // Note: WinPMail's socket handling is fully non-blocking so you can
  359. // open multiple sockets simultaneously without contention problems.
  360. // The exception to this is name resolution calls, which may block,
  361. // and which may therefore cause transient failures. This will be
  362. // addressed in future, but for now the easiest way to avoid this
  363. // as a problem is to use numeric IP addresses instead of names
  364. // wherever possible.
  365.  
  366. //  Open a TCP/IP connection
  367. //  ** PARAMETERS: wParam = host port; lParam = pointer to host
  368. //     address in either domain name or dotted-IP format.
  369. //  ** RETURNS:    -1 on failure
  370. #define WM_F_TCPOPEN             (WM_F_FORMBASE + 29)
  371.  
  372. //  Get a line of data from an open TCP/IP port. The terminating LF or
  373. //  CR/LF is not removed from the returned data.
  374. //  ** PARAMETERS: wParam = length of buffer; lParam = pointer to buffer
  375. //  ** RETURNS:    > 0 = OK; 0 = timeout; < 0; TCP/IP error
  376. #define WM_F_TCPGETS             (WM_F_FORMBASE + 34)
  377.  
  378. //  Write a line of data to an open TCP/IP port; does not add CRLF. The
  379. //  data is presumed to be a nul-terminated C string.
  380. //  ** PARAMETERS: wParam = unused; lParam = pointer to data to write
  381. //  ** RETURNS:    > 0 = OK; 0 = timeout; < 0; TCP/IP error
  382. #define WM_F_TCPPUTS             (WM_F_FORMBASE + 35)
  383.  
  384. //  Close an open TCP/IP connection
  385. //  ** PARAMETERS: wParam = unused; lParam = unused
  386. //  ** RETURNS:    -1 on failure
  387. #define WM_F_TCPCLOSE            (WM_F_FORMBASE + 36)
  388.  
  389. //  Determine whether TCP/IP services are available and configured
  390. //  ** PARAMETERS: wParam = unused; lParam = unused
  391. //  ** RETURNS:    1 = OK to use TCP/IP services; 0 = no TCP/IP services
  392. #define WM_F_TCPPRESENT          (WM_F_FORMBASE + 37)
  393.  
  394. //  Return the domain name of the current machine. If no domain name
  395. //  can be determined, return the machine's IP address in dotted format.
  396. //  ** PARAMETERS: wParam = length of buffer; lParam = pointer to buffer
  397. //  ** RETURNS:    Nothing
  398. #define WM_F_TCPMYNAME           (WM_F_FORMBASE + 38)
  399.  
  400. //  Set the socket which will be used in subsequent TCP/IP calls.
  401. //  The default socket is 0, so if you only ever have a single
  402. //  connection open at any time you will never need to use this
  403. //  message. Each extension (or instance of an extension) can have up
  404. //  to five connections open simultaneously and can select the one you
  405. //  are interested in using this message
  406. //  ** PARAMETERS: wParam = desired socket (0..4); lParam = unused
  407. //  ** RETURNS:    Nothing
  408. #define WM_F_TCPSETSOCKET        (WM_F_FORMBASE + 49)
  409.  
  410. //  Initiate a regular POP3 connection and download mail to the
  411. //  local machine. If wParam is 0, a progress dialog will be put
  412. //  up during the transaction. If lParam is 0 (NULL) then the
  413. //  standard host configuration provided by the user will be used
  414. //  for host and username information; alternatively, lParam can
  415. //  point to a copy of the following structure:
  416. #ifndef PROFILE_INCLUDED
  417. #define MAXHOST 80
  418. typedef struct
  419.    {
  420.    char pop3host [MAXHOST];   //  POP3 server address
  421.    char smtphost [MAXHOST];   //  SMTP server address
  422.    char username [48];        //  POP3 account name
  423.    char password [48];        //  POP3 account password
  424.    char mask [64];            //  Path and filespec to find SMTP files
  425.    char mailbox [80];         //  Where to place incoming POP3 messages
  426.    long threshhold;           //  Largest message to download, in bytes
  427.    int delete_mail;           //  If NZ, delete successfully downloaded mail
  428.    long wflags;
  429.    char from_field [MAXHOST]; //  Contents of the message's "from" field
  430.    int timeout;               //  TCP/IP timeout (seconds)
  431.    char memory_file [14];     //  State info file when leaving mail on server
  432.    } POPDEF;
  433. #endif
  434. //  ** PARAMETERS: wParam = 0/NZ;dialog/none; lParam = NULL/see above
  435. //  ** RETURNS:    None
  436. #define WM_F_TCPPOP3             (WM_F_FORMBASE + 52)
  437.  
  438. //  Initiate a regular POP3 connection but ONLY check that the
  439. //  user and password information supplied is valid. No actual
  440. //  mail transaction is performed. A dialog is never put up for
  441. //  this routine, although messages may appear on the statusline.
  442. //    If wParam is non-zero, the POP3 code will establish a con-
  443. //  nection to the POP3 server, will authenticate the user, and
  444. //  will then return control in the open state. If you use this
  445. //  feature, it is up to you to issue proper POP3 commands to
  446. //  manage the session and close it down gracefully.
  447. //    If lParam is 0 (NULL) then the standard host configuration
  448. //  provided by the user will be used for host and username
  449. //  information; alternatively, lParam can point to a copy of
  450. //  the POPDEF structure shown above.
  451. //  ** PARAMETERS: wParam = unused; lParam = NULL/see above
  452. //  ** RETURNS:    1 if the information is valid, 0 if not.
  453. //  ** Note: it is not possible to determine in any meaningful way
  454. //  which of the username or password was incorrect if verification
  455. //  fails, because most POP3 servers accept any username for security
  456. //  reasons.
  457. #define WM_F_TCPOP3VERIFY        (WM_F_FORMBASE + 55)
  458.  
  459. //  Initiate a regular POP3 connection but ONLY count the number
  460. //  of messages waiting on the account. No actual mail download is
  461. //  performed and a dialog is never put up although messages may
  462. //  appear on the statusline. If lParam is 0 (NULL) then the
  463. //  standard host configuration provided by the user will be used
  464. //  for host and username information; alternatively, lParam can
  465. //  point to a copy of the POPDEF structure shown above.
  466. //  ** PARAMETERS: wParam = unused; lParam = NULL/see above
  467. //  ** RETURNS:    -1 on error, message count otherwise
  468. #define WM_F_TCPOP3COUNT         (WM_F_FORMBASE + 56)
  469.  
  470. //  Initiate a regular SMTP connection using the built-in client.
  471. //    If wParam is 0, a progress dialog will be put up during the
  472. //  transaction. As with WM_F_TCPPOP3, you can pass a POPDEF
  473. //  structure pointer in lParam to specify an alternative host.
  474. //  ** PARAMETERS: wParam = 0/NZ;dialog/none; lParam = NULL/see above
  475. //  ** RETURNS:    None
  476. //  ** Note: for security reasons, WinPMail will only send mail using
  477. //  the SMTP protocol if it can verify your POP3 information by
  478. //  connecting to the specified POP3 server; no verification, no send.
  479. #define WM_F_TCPSMTP             (WM_F_FORMBASE + 53)
  480.  
  481. //  Read raw data from a TCP/IP port. lParam points to a buffer where
  482. //  the data should be written: if wParam is non-zero, then it is
  483. //  whichever is the lesser of the size of the buffer, or the maximum
  484. //  number of bytes to read. If wParam is zero, then the buffer must
  485. //  be 1024 bytes long and the routine will wait until any data appears
  486. //  on the port then return it, up to 1024 bytes in length. This latter
  487. //  application is useful when dealing with protocols where you don't
  488. //  necessarily know how much data you are going to receive in advance.
  489. //  ** PARAMETERS: wParam = 0, or bufsize/maxdata; lParam = buffer address
  490. //  ** RETURNS:    The actual number of bytes read; < 0 indicates an
  491. //                 error; 0 indicates either socket closed or timeout.
  492. #define WM_F_TCPREAD             (WM_F_FORMBASE + 59)
  493.  
  494. //  Write raw data to a TCP/IP port. lParam points to the data to write,
  495. //  and wParam points to the length of the data. The data is written
  496. //  without any modification. This routine never blocks, and enters an
  497. //  internal message processing loop while waiting for the data to clear.
  498. //  ** PARAMETERS: wParam = length of data; lParam = pointer to data
  499. //  ** RETURNS:    -1 on hard error; 0 on timeout; >0 on success (the
  500. //                   number of bytes actually written).
  501. #define WM_F_TCPWRITE            (WM_F_FORMBASE + 60)
  502.  
  503. //
  504. // +--------------------------------------------------------------------+
  505. // |  Section 4:                                                        |
  506. // |  Calls available only to READER extensions                         |
  507. // +--------------------------------------------------------------------+
  508. //
  509.  
  510. //  A reader extension can call this to open the original message
  511. //  passed to it at startup.
  512. //  ** PARAMETERS: wParam = unused; lParam = unused
  513. //  ** RETURNS:    1 if successfully opened; 0 on failure.
  514. #define WM_F_OPENMESSAGE         (WM_F_FORMBASE + 42)
  515.  
  516. //  Read a line from the original message. The message must have been
  517. //  opened successfully by calling WM_F_OPENMESSAGE before calling this
  518. //  routine.
  519. //  ** PARAMETERS: wParam = maximum length to read; lParam = pointer to buffer
  520. //  ** RETURNS:    1 if data was read, 0 on failure (usually EOF).
  521. #define WM_F_READLINE            (WM_F_FORMBASE + 43)
  522.  
  523. //  Close a message file opened with WM_F_OPENMESSAGE.
  524. //  ** PARAMETERS: wParam = unused; lParam = unused.
  525. //  ** RETURNS:    Nothing.
  526. #define WM_F_CLOSEMESSAGE        (WM_F_FORMBASE + 44)
  527.  
  528. //  Get the flag longword for the message. The message does NOT have to
  529. //  be open in order for this call to succeed.
  530. //  ** PARAMETERS: wParam = unused; lParam = unused.
  531. //  ** RETURNS:    Flag longword (32 bits)
  532. #define WM_F_GETFLAGS            (WM_F_FORMBASE + 45)
  533.  
  534. //  Set the flag longword for the message. The message does NOT have
  535. //  to be open in order for this call to succeed. Note; this function
  536. //  is only provided to allow you to alter the "has been read", "replied",
  537. //  "forwarded" and "is annotated" flags. Changing or setting any other
  538. //  bit in the flag longword may have unexpected consequences and should
  539. //  only be done if you're absolutely sure of what you're doing.
  540. //  ** PARAMETERS: wParam = unused; lParam = Flag longword.
  541. //  ** RETURNS:    Nothing
  542. #define WM_F_SETFLAGS            (WM_F_FORMBASE + 46)
  543.  
  544. //  The flag longword is a 32-bit bitmap which can consist of the
  545. //  following values:
  546. #ifndef WINPMAIL
  547. #define FILE_MAILED     1           // Message has local-style PMF attachments
  548. #define UUENCODED       2           // "   "   "   uuencoded attachments
  549. #define FILE_ATTACHED   0x800003L   // Use this as an attachment mask.
  550. #define ENCRYPTED       4           // Message is encrypted.
  551. #define EXPIRED         16          // Message is past its expiry date
  552. #define HAS_BEEN_READ   128         // The reader has opened the message
  553. #define CONFIRMATION    8192        // Sender wants confirmation of reading
  554. #define COPYSELF       0x20000L     // Message is a copy to self
  555. #define DELETED        0x40000L     // Message has been deleted.
  556. #define MIME           0x80000L     // Message is a MIME transmission
  557. #define REPLIED       0x100000L     // Message has been replied to.
  558. #define FORWARDED     0x200000L     // Message has been forwarded.
  559. #define URGENT        0x400000L     // Message is urgent/high priority.
  560. #define BINHEX        0x800000L     // Message contains BinHex-encoded data
  561. #define IS_MHS       0x1000000L     // Message originates from MHS
  562. #define IS_SMTP      0x2000000L     // Message originates from SMTP
  563. #define IS_ANNOTATED 0x4000000L     // The message has an annotation
  564. #define ENCLOSURE    0x8000000L     // The message has enclosures
  565. #endif
  566.  
  567. //  Get details about an attachment from a message. wParam should
  568. //  indicate the index to the attachment for which data is required 
  569. //  (numbering from 0 as the first attachment) or -1 if you only want
  570. //  it to return a count of the number of attachments. lParam should
  571. //  point to an ATTACHMENT structure as defined in the WM_F_ATTACH
  572. //  message. You should generally only call this routine if the flag
  573. //  longword for the message indicates that attachments are present,
  574. //  although this routine does a much more thorough examination of the
  575. //  message for enclosures than the standard message parser and may
  576. //  pick up some which it misses.
  577. //  ** PARAMETERS: wParam = index or -1; lParam = pointer to ATTACHMENT
  578. //  ** RETURNS:    Number of attachments to message, or -1 on error
  579. //  ** Note:       This call cannot be used to handle components of
  580. //                 multipart MIME messages, since they are not necessarily
  581. //                 attachments. Pegasus Mail's own multipart browser is
  582. //                 capable of loading reader extensions for individual
  583. //                 components, but if you want to write your own multipart
  584. //                 browser to replace the built-in browser, you will have
  585. //                 handle the MIME sub-parsing yourself.
  586. #define WM_F_ATTACHMENTINFO      (WM_F_FORMBASE + 47)
  587.  
  588. //  Extract an attachment from a message into a specified file. wParam
  589. //  should indicate the index to the attachment required. lParam should
  590. //  point to a filename string; if lParam is NULL or if the first char
  591. //  in the filename string is an ASCII NUL (0), then WinPMail will
  592. //  prompt the user for a filename, and if lParam is non-NULL, will
  593. //  return it in lParam (allocate at least 128 characters). All decoding
  594. //  of the message is performed automatically, including MIME translations.
  595. #define WM_F_EXTRACTATTACHMENT   (WM_F_FORMBASE + 48)
  596.  
  597.  
  598. //
  599. // +--------------------------------------------------------------------+
  600. // |  Section 5:                                                        |
  601. // |  Logging messages                                                  |
  602. // +--------------------------------------------------------------------+
  603. //
  604. // Extensions can indicate an interest in logging events by setting the
  605. // WPM_LOGGING bit in the flags field of their form fact file. An extension
  606. // which has set the logging bit will receive messages from WinPMail about
  607. // a number of events which can occur in a user session, including mail
  608. // being sent, files being created and deleted, and so on.
  609. //
  610. // Logging extensions can also inhibit certain events from happening by
  611. // returning WPM_PROHIBIT instead of 0; note that if an extension prohibits
  612. // an action, it is up to the extension to indicate an error message or
  613. // warning explaining to the user why it has done so (if appropriate) -
  614. // WinPMail will not do so.
  615. //
  616. // There are no limitations on what a logging extension can do, although
  617. // in almost every case they will set the WPM_STARTUP bit to load at
  618. // runtime. Logging extensions may generate mail messages at any time.
  619. //
  620.  
  621. //  WinPMail generates this message when the user sends a mail message,
  622. //  before any actual processing is done on the message itself. When a
  623. //  logging extension receives this message, it can call 
  624. //  WM_F_GETMESSAGEFIELD as shown below to retrieve message fields 
  625. //  until the time it returns. A logging extension can prohibit sending a
  626. //  message by returning WPM_PROHIBIT when it receives this message.
  627. #define WM_FM_SENDMAIL           (WM_FM_FORMBASE + 8)
  628.  
  629. //  WinPMail generates this message to cover a variety of system
  630. //  events. In most cases, returning WPM_PROHIBIT will prevent the
  631. //  action from occurring.
  632. //  ** PARAMETERS: wParam = event type; lParam = string descriptor
  633. //    wParam can have the following values:
  634. //                      wParam      lParam                            Prohibit?
  635. #define WLOG_OPEN_FILE    1     //  Filename of book to be opened         Y
  636. #define WLOG_DEL_FILE     2     //  "   "   "   "   "   be deleted        Y
  637. #define WLOG_NEW_FILE     3     //  Unused                                Y
  638. #define WLOG_REN_FILE     4     //  Old filename of book to be renamed    Y
  639. #define WLOG_OPEN_FOLDER  5     //  Path to folder to be opened           Y
  640. #define WLOG_DEL_FOLDER   6     //  "   "   "   "   "   be deleted        Y
  641. #define WLOG_NEW_FOLDER   7     //  Unused                                Y
  642. #define WLOG_REN_FOLDER   8     //  Old filename of folder to be renamed  Y
  643. #define WLOG_EDIT_FILE    9     //  Filename of dlist to be edited        Y
  644. #define WLOG_ACTIVATE     10    //  1=activating, 0=minimizing            Y
  645. //  WLOG_NEWMESSAGE is sent before the window is actually
  646. //  created and displayed; WLOG_NEWMESSAGE1 is sent after the
  647. //  window has been completely created.
  648. #define WLOG_NEWMESSAGE   11    //  Unused                                Y
  649. #define WLOG_NEWMESSAGE2  12    //  HWND of new message                   N
  650. //  WLOG_ENTERPREFS is called before entering any of the preferences
  651. //  dialogs in WinPMail, using one of the following values in lParam
  652. enum
  653.    {
  654.    WPREF_GENERAL, WPREF_ADVANCED, WPREF_SMF, WPREF_HOMEBOX,
  655.    WPREF_EXTENDED, WPREF_SIGS, WPREF_BPANEL, WPREF_NETCONFIG
  656.    };
  657. #define WLOG_ENTERPREFS    13   //  Code from list above                  Y
  658. //  WLOG_GETMAIL is sent prior to downloading mail via POP3
  659. #define WLOG_GETMAIL       14   //  Unused                                Y
  660. //  WLOG_SMTPSEND is sent before opening an outgoing SMTP connection
  661. #define WLOG_SMTPSEND      15   //  Unused                                Y
  662. //  WLOG_NEWEXTENSION is sent before an extension is loaded
  663. #define WLOG_NEWEXTENSION  16   //  Path to extension file                Y
  664. #define WLOG_ERROR         17   //  Integer - ID of error message         Y
  665. #define WLOG_WARNING       18   //  Integer - ID of warning message       Y
  666. //  WLOG_LOADEXTENSION is sent AFTER an extension has been loaded
  667. #define WLOG_LOADEXTENSION 19   //  HWND - window containing new form     N
  668. #define WLOG_OPENNEWMAIL   20   //  Unused
  669. #define WLOG_PARSENEW      21   //  Path to new message file              Y
  670. //
  671. //  Detecting when menus are loaded: WLOG_LOADMENU is generated when an
  672. //  MDI window in WinPMail loads a menu. The completed menu is passed to
  673. //  the extension in an LMENU structure, and while the extension cannot
  674. //  suppress the loading of the menu, it can modify the menu. Note that
  675. //  each menu is a complete copy of the entire menu system, including
  676. //  File, Edit, Addresses, and Window submenus as well as the specific
  677. //  menu for the subwindow itself.
  678. //
  679. typedef struct
  680.    {
  681.    HMENU hMenu;
  682.    int menu_id;
  683.    } LMENU;
  684. //  "menu_id" can have the following values:
  685. //
  686. #ifndef WINPMAIL
  687. enum
  688.    {
  689.    MN_FRAME = 1,        //  Pegasus Mail's frame (main window) menu
  690.    MN_EDMAIL,           //  Message editor menu ("Message")
  691.    MN_READER,           //  Message reader menu ("Reader")
  692.    MN_BROWSE,           //  Folder browser menu ("Folder")
  693.    MN_DLIST,            //  DList editor menu (no specific menu entry)
  694.    MN_ADDRBOOK,         //  Addressbook menu ("Addressbook")
  695.    MN_FOLMAN,           //  Floating Folder Manager menu ("Folders")
  696.    MN_FORMS,            //  Extensions Manager menu (no specific entry)
  697.    MN_NB                //  Noticeboards menu.
  698.    };
  699. #endif
  700. //
  701. #define WLOG_LOADMENU      22   //  Pointer to LMENU structure (above)    N
  702. #define WLOG_SENDERROR     23   //  Locus of delivery failure             N
  703.  
  704. #define WM_FM_LOGEVENT           (WM_FM_FORMBASE + 9)
  705.  
  706.  
  707. //  Retrieve a field from a message. This message can only be sent
  708. //  after a logging extension receives a WM_FM_SENDMAIL message but
  709. //  before it returns from processing it.
  710. //  ** PARAMETERS: wParam = field of interest
  711. //  ** RETURNS:    pointer to data in every case.
  712. //
  713. //  wParam can be set to the following values:
  714. //      wParam value:          type      pointer to
  715. #define WMSG_TO       1    //  string    raw to: data
  716. #define WMSG_SUBJECT  2    //  string    subject: field
  717. #define WMSG_CC       3    //  string    cc: field
  718. #define WMSG_BCC      4    //  string    bcc: field
  719. #define WMSG_REPLYTO  5    //  string    reply-to: field
  720. #define WMSG_DATA     6    //  string    message, NULL if file.
  721. #define WMSG_FILE     7    //  string    filename, NULL if data
  722. #define WMSG_ENCRYPT  8    //  char      NZ if encrypted, Z if not
  723. #define WMSG_COPYSELF 9    //  char      NZ if copying to self
  724. #define WMSG_READING  10   //  char      NZ if reading confirm required
  725. #define WMSG_DELIVERY 11   //  char      NZ if delivery confirm required
  726. #define WMSG_URGENT   12   //  char      NZ if urgent
  727. #define WMSG_NOSIG    13   //  char      NZ if no signature to be attached
  728. #define WMSG_EXPIRES  14   //  byte [7]  expiration, NetWare date format
  729. #define WMSG_KEY      15   //  string    encryption key
  730. //
  731. //  Note that the returned value is ALWAYS a pointer, which allows a
  732. //  logging extension to change message field values before they are
  733. //  sent. Extensions are discouraged from modifying fields casually -
  734. //  fields should only be changed when you are sure of what you are
  735. //  doing.
  736. #define WM_F_GETMESSAGEFIELD     (WM_F_FORMBASE + 50)
  737.  
  738.  
  739. //
  740. // +--------------------------------------------------------------------+
  741. // |  Section 6:                                                        |
  742. // |  File system, message store and informational services             |
  743. // +--------------------------------------------------------------------+
  744. //
  745. // Extensions can access the user's message store and also have access
  746. // to a great deal of the internal system information WinPMail maintains.
  747. //
  748.  
  749. //  Get the full path to the user's new mail folder.
  750. //  lParam points to a buffer into which the path should be copied,
  751. //  and wParam is the maximum length of the string to copy, including
  752. //  the terminating nul. You should allocate at least 128 characters.
  753. //  The string returned is a full path normalized to "\" separators
  754. //  and does not have a trailing "\" character.
  755. //  ** Note: do NOT assume that this is a DOS path: it may just as
  756. //  well be supplied in UNC or NetWare formats depending on the system.
  757. //  ** PARAMETERS: wParam = max length; lParam = pointer to buffer
  758. //  ** RETURNS:    Nothing
  759. #define WM_F_GETNEWMAILBOX       (WM_F_FORMBASE + 21)
  760.  
  761. //  Get the full path to the user's home mailbox directory.
  762. //  lParam points to a buffer into which the path should be copied,
  763. //  and wParam is the maximum length of the string to copy, including
  764. //  the terminating nul. You should allocate at least 128 characters.
  765. //  The string returned is a full path normalized to "\" separators
  766. //  and does not have a trailing "\" character.
  767. //  ** PARAMETERS: wParam = max length; lParam = pointer to buffer
  768. //  ** RETURNS:    Nothing
  769. //  ** Note: do NOT assume that this is a DOS path: it may just as
  770. //  well be supplied in UNC or NetWare formats depending on the system.
  771. #define WM_F_GETHOMEBOX          (WM_F_FORMBASE + 22)
  772.  
  773. //  Get the full path to the recommended temporary files directory.
  774. //  lParam points to a buffer into which the path should be copied,
  775. //  and wParam is the maximum length of the string to copy, including
  776. //  the terminating nul. You should allocate at least 128 characters.
  777. //  The string returned is a full path normalized to "\" separators
  778. //  and does not have a trailing "\" character.
  779. //  ** PARAMETERS: wParam = max length; lParam = pointer to buffer
  780. //  ** RETURNS:    Nothing
  781. #define WM_F_GETTEMPDIR          (WM_F_FORMBASE + 23)
  782.  
  783. //  Get the full path to the directory from which WINPMAIL.EXE was
  784. //  run. lParam points to a buffer into which the path should be
  785. //  copied and wParam is the maximum length of the string to copy,
  786. //  including the terminating nul. You should allocate at least 128
  787. //  characters. The string returned is a full path in DOS format
  788. //  and does not have a trailing "\" character.
  789. #define WM_F_GETBASEDIR          (WM_F_FORMBASE + 65)
  790.  
  791. //  Get the fully-qualified path name of a temporary file which
  792. //  is guaranteed not to exist, and to be writable. wParam contains
  793. //  the maximum length allocated for the filename including the
  794. //  terminating Nul, while lParam points to the location where the
  795. //  filename should be written.
  796. //  ** PARAMETERS: wParam = max length; lParam = pointer to buffer
  797. //  ** RETURNS:    Nothing
  798. #define WM_F_TEMPFILE            (WM_F_FORMBASE + 24)
  799.  
  800. //  Get the number of new mail messages currently in the user's
  801. //  new mail box. If wParam is 0, WinPMail returns the value from the
  802. //  last periodic scan it made; if wParam is non-zero, WinPMail is
  803. //  forced to rescan the new mail box immediately - depending on
  804. //  the number of messages already in the new mail box, this may
  805. //  result in a considerable impact on system performance. Returns
  806. //  the number of messages.
  807. //  ** PARAMETERS: wParam = (see above); lParam = unused
  808. //  ** RETURNS:    Total number of new messages in mailbox
  809. #define WM_F_NEWMAIL             (WM_F_FORMBASE + 28)
  810.  
  811. //  Prompt the user to select a WinPMail file. The standard WinPMail
  812. //  selector dialog is opened and control is not returned until the
  813. //  user either selects an item or cancels it.
  814. //  ** PARAMETERS: 
  815. //     wParam can have the following values:
  816. //        0 - select a folder
  817. //        1 - select an address book
  818. //        2 - select a distribution list
  819. //        3 - select a message draft
  820. //     lParam = points to a char buffer at least 128 characters long
  821. //        - the buffer is filled with the full path name to the selected
  822. //          file. For address books, the .PMR file is returned. For
  823. //          folders, the .PMM file is returned.
  824. //  ** RETURNS: 1 if the user selected an item, 0 for no selection.
  825. #define WM_F_SELECTOR            (WM_F_FORMBASE + 39)
  826.  
  827. //  Open one of the standard Pegasus Mail file types. lParam must point
  828. //  to the full path to the file (as returned by WM_F_SELECTOR), and
  829. //  wParam must be set to:
  830. //        0 - File is a mail folder
  831. //        1 - File is an address book
  832. //        2 - File is a distribution list
  833. //        3 - File is a message draft
  834. //        4 - File is a message queued for delivery
  835. //      255 - No file - simply start a new message
  836. //  Note that for Folders you must pass the path to the folder's PMM
  837. //  file, and for Addressbooks to the book's .PMR file. The extensions
  838. //  for the various types of files are:
  839. //     Folders            - .PMM
  840. //     Addressbooks       - .PMR
  841. //     Distribution lists - .PML
  842. //     Message drafts     - .PMO
  843. //     Queued mail        - .PMW
  844. //  ** PARAMETERS: wParam (see above); lParam = file to open.
  845. //  ** RETURNS:    hWnd of newly-opened MDI window, NULL on failure.
  846. #define WM_F_OPENFILE            (WM_F_FORMBASE + 66)
  847.  
  848. //  Preferences services. Get or set the value of an entry in the
  849. //  user's preferences (PMAIL.INI) file. Examine the file WPMPREFS.H
  850. //  for documentation on the possible values you can pass in these
  851. //  calls.
  852. //  ** PARAMETERS:
  853. //     - WM_F_SETPREF: wParam = item to set; lParam = value
  854. //     - WM_F_GETPREF: wParam = item to get; lParam = buffer pointer
  855. //  ** RETURNS:
  856. //     - WM_F_SETPREF: Nothing
  857. //     - WM_F_GETPREF: Value (for scalar types).
  858. #define WM_F_GETPREF             (WM_F_FORMBASE + 40)
  859. #define WM_F_SETPREF             (WM_F_FORMBASE + 41)
  860.  
  861. //  Get the name of the user at the current workstation. wParam can
  862. //  have the following values:
  863. //    0: return the basic username (login name under NetWare)
  864. //    1: return the user's name as a full Internet address
  865. //    2: return the user's name as an MHS address
  866. //  lParam should point to a buffer at least 256 characters in length.
  867. //  ** PARAMETERS: wParam = (see above); lParam = pointer to buffer
  868. //  ** RETURNS:    1 on success; 0 if the address form is unavailable.
  869. #define WM_F_GETUSERNAME         (WM_F_FORMBASE + 58)
  870.  
  871.  
  872. //
  873. // +--------------------------------------------------------------------+
  874. // |  Section 7:                                                        |
  875. // |  Miscellaneous services                                            |
  876. // +--------------------------------------------------------------------+
  877. //
  878.  
  879. //  Return the current date and time in NetWare format - ie, an
  880. //  array of seven bytes arranged as follows:
  881. //
  882. //     Byte 0  - Year modulus 100 (if less than 80 assume 20xx)
  883. //     Byte 1  - Month - 1 (ie, January == 0)
  884. //     Byte 2  - Day (1 .. 31)
  885. //     Byte 3  - Hour (0 - 24)
  886. //     Byte 4  - Minute (0 - 59)
  887. //     Byte 5  - Second (0 - 60)
  888. //     Byte 6  - Day of week (Sunday == 0)
  889. //
  890. //  The function returns a correctly-formatted value whether or not
  891. //  you are actually attached to a NetWare system, and deals correctly
  892. //  with shell problems under Windows Standard mode which can result
  893. //  in NetWare returning garbage times. Where possible, this function
  894. //  gets the time from the file server instead of from the local
  895. //  workstation.
  896. //  ** PARAMETERS: wParam = unused; lParam = pointer to 7-byte buffer area
  897. //  ** RETURNS:    Nothing
  898. #define WM_F_GETDATETIME         (WM_F_FORMBASE + 25)
  899.  
  900. //  Return a date and time string in legal RFC822 format. You can
  901. //  either set lParam to point to a 7-byte structure as described in
  902. //  WM_F_GETDATETIME above, or else you can set lParam to 0 to get
  903. //  a legal RFC822 representation of the current time. The return
  904. //  from this message is a pointer to a static buffer in memory
  905. //  containing the formatted string. You must NEVER directly alter
  906. //  this buffer or you may crash WinPMail. The buffer is overwritten
  907. //  on each call, and may be overwritten indirectly by other internal
  908. //  WinPMail routines, so if you do not intend to use this string
  909. //  immediately, you would be well advised to copy it to a local buffer.
  910. //  ** PARAMETERS: wParam = unused; lParam = (optional) 7-byte date structure
  911. //  ** RETURNS:    Read-only far pointer to character array containing date.
  912. #define WM_F_GETRFC822DATETIME   (WM_F_FORMBASE + 26)
  913.  
  914. //  Reduce an e-mail address to its minimum form, by removing any
  915. //  Ctext or Qtext components - so, the address
  916. //      "David Harris" <david@pmail.gen.nz> (Pegasus Mail Author)
  917. //  would be reduced to
  918. //       david@pmail.gen.nz
  919. //  lParam should point to the raw address, which is overwritten with
  920. //  the reduced form. The returned value is guaranteed never to be
  921. //  longer than the value passed in.
  922. //  ** PARAMETERS: wParam = unused; lParam = raw address data
  923. //  ** RETURNS:    -1 on invalid address (unbalanced '()' or '<>' pairs)
  924. //  ** Note: this function works equally well for both RFC822 and
  925. //  MHS addresses, but you should be aware that comments in '()' pairs
  926. //  are sometimes significant to some MHS gateways.
  927. #define WM_F_PARSEADDRESS        (WM_F_FORMBASE + 27)
  928.  
  929. //  Allocate memory in WinPMail's heap. This call is specialised and
  930. //  is generally not needed. wParam contains the number of bytes to
  931. //  allocate; the return value is NULL on failure, or a pointer on
  932. //  success. Note that memory obtained this way must ONLY be freed
  933. //  using the WM_F_FREE message.
  934. //  ** PARAMETERS: wParam = bytes to allocate; lParam = unused
  935. //  ** RETURNS:    Pointer, or NULL on failure
  936. #define WM_F_MALLOC              (WM_F_FORMBASE + 30)
  937.  
  938. //  Free a block of memory obtained using WM_F_MALLOC
  939. //  ** PARAMETERS: wParam = unused; lParam = pointer returned by WM_F_MALLOC
  940. //  ** RETURNS:    Nothing
  941. #define WM_F_FREE                (WM_F_FORMBASE + 31)
  942.  
  943. //  A handy function to retrieve the text from a standard Windows
  944. //  edit control in a format ready to be dumped to a file or passed
  945. //  to WinPMail for delivery; pass the ID of the control in the
  946. //  current dialog in wParam and WinPMail will return the text from
  947. //  that control, properly formatted, with all carriage returns
  948. //  stripped (ie, as a C string). The pointer returned is allocated
  949. //  using the WM_F_MALLOC message and must be freed using WM_F_FREE.
  950. //  ** PARAMETERS: wParam = edit control ID; lParam = unused
  951. //  ** RETURNS:    Pointer to formatted textual data or NULL on failure
  952. #define WM_F_GETTEXT             (WM_F_FORMBASE + 32)
  953.  
  954. //  Change the active dialog in the window. This function is needed
  955. //  if your DLL can produce more than one dialog in the MDI child
  956. //  window and can change between them (presumably in response to
  957. //  user input, much like the WinPMail message editor dialog). When
  958. //  the dialog active in the window changes and the window is in the
  959. //  foreground, you should call this function to ensure that WinPMail
  960. //  directs messages to the correct dialog. Pass the address of the
  961. //  new dialog in lParam.
  962. //  ** PARAMETERS: wParam = unused; lParam = HWND of new dialog
  963. //  ** RETURNS:    Nothing
  964. #define WM_F_SETDIALOG           (WM_F_FORMBASE + 33)
  965.  
  966. //  Set text on the statusline. Four text areas can be set on the
  967. //  statusline:
  968. //     0: The basic text area at the left-hand end of the bar
  969. //     1: The text in the username/server panel of the bar
  970. //     2: The text in the newmail panel of the bar
  971. //     3: A double-size text area overlaid over 0 and 1
  972. //  You can also reset the statusbar by setting wParam to 0 and
  973. //  passing a pointer to a NULL string
  974. //  ** PARAMETERS: wParam = panel to set; lParam = text to set
  975. //  ** RETURNS:    Nothing.
  976. #define WM_F_SETSTATUS           (WM_F_FORMBASE + 51)
  977.  
  978. //  Paste an arbitrary string of data into the last active control
  979. //  (which will almost always be one of the addressing Edit fields).
  980. //  Using this call allows you to duplicate the behaviour of the
  981. //  WinPMail local user list or address books when the user clicks
  982. //  the "paste" button. If wParam is non-zero, WinPMail will add a
  983. //  newline (CRLF) to the data if the target control is capable of
  984. //  supporting multiple lines; this is a handy way of allowing the
  985. //  user to paste your data either into single address fields or into
  986. //  distribution lists without you having to be worried about the
  987. //  distinction. If wParam is zero, the data will be pasted as-is.
  988. //  ** PARAMETERS: wParam = see above; lParam = (char *) text to paste
  989. //  ** RETURNS:    0 if no pasting was possible, 1 on success.
  990. #define WM_F_PASTEDATA           (WM_F_FORMBASE + 54)
  991.  
  992. //  Get a core WinPMail window. This function allows you to obtain
  993. //  the HWND for either the WinPMail Frame window (the main application
  994. //  window itself) or the MDI Client window maintained inside it. This
  995. //  function is extremely specialised and is really only useful if you
  996. //  are brave enough to want to enumerate the program's child windows
  997. //  (possibly to send them all messages or to find all windows of a
  998. //  particular type). You should avoid using this message if you can,
  999. //  since it may impair the portability of your extension. WinPMail's
  1000. //  author offers no guarantee that windows will retain the same class
  1001. //  names or other information throughout the life of the program.
  1002. //  wParam can have the following values for this call:
  1003. //     0 - return the WinPMail main frame window
  1004. //     1 - return the WinPMail MDI client window
  1005. //     2 - return the currently active MDI child window
  1006. //     3 - return the dialog contained in the currently active MDI window
  1007. //     4 - return the toolbar window (note - ONLY if currently a toolbar)
  1008. //  ** PARAMETERS: wParam = see above; lParam = unused.
  1009. //  ** RETURNS:    The HWND for the specified window.
  1010. #define WM_F_GETWINDOW           (WM_F_FORMBASE + 57)
  1011.  
  1012. //  Get a core WinPMail menu. This function lets you retrieve any
  1013. //  of the menu handles associated with each type of WinPMail MDI
  1014. //  window. wParam should contain one of the MN_* selector values
  1015. //  defined for the WLOG_LOADMENU logging event (above). The return
  1016. //  value is the menu handle for that window, which may be NULL if
  1017. //  no instance of that type of window has been opened yet.
  1018. //  ** PARAMETERS: wParam = MN_* selector value; lParam = unused
  1019. //  ** RETURNS:    menu handle (may be NULL)
  1020. #define WM_F_GETMENU             (WM_F_FORMBASE + 63)
  1021.  
  1022. //  Load and execute a new extension. lParam must point to an instance
  1023. //  of the following parameter block:
  1024. typedef struct
  1025.    {
  1026.    char dll_path [128];
  1027.    int variant;
  1028.    char commandline [128];
  1029.    char title [64];
  1030.    unsigned int flags;
  1031.    } FORM_PARAM;
  1032. //
  1033. //  "dll_name" is the fully-qualified path to the DLL containing the
  1034. //     extension's executable code. It may contain valid command
  1035. //     substitutions (such as ~a for the Pegasus Mail base directory).
  1036. //  "variant" is 0 for a Composer extension, or 1 for a Reader extension.
  1037. //     Note that until advised in future, only Composer extensions can
  1038. //     be loaded with this call.
  1039. //  "commandline" is whatever parameters should be passed to the extension
  1040. //     at startup.
  1041. //  "title" is the title of the new extension's enclosing MDI window
  1042. //  "flags" is a bitmap comprised of the following values:
  1043. //     WPM_HIDDEN    4      Hide the parent MDI window on loading
  1044. //     WPM_LOGGING   8      Extension wants to receive logging events
  1045. //     WPM_ONEONLY   16     Only allow one running instance at any time
  1046. //
  1047. //  ** PARAMETERS: wParam = unused; lParam = pointer to FORM_PARAM
  1048. //  ** RETURNS:    HWND of new extension's MDI window or NULL on failure
  1049. #define WM_F_LOADEXTENSION       (WM_F_FORMBASE + 64)
  1050.  
  1051.