home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / mapi.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  11.7 KB  |  365 lines

  1. /*
  2.  *  M A P I . H
  3.  *
  4.  *  Messaging Applications Programming Interface.
  5.  *
  6.  *  Copyright 1986-1996 Microsoft Corporation. All Rights Reserved.
  7.  *
  8.  *  Purpose:
  9.  *
  10.  *    This file defines the structures and constants used by that
  11.  *    subset of the Messaging Applications Programming Interface
  12.  *    which is supported under Windows by Microsoft Mail for PC
  13.  *    Networks version 3.x.
  14.  */
  15.  
  16.  
  17. #ifndef MAPI_H
  18. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  19. #define MAPI_H
  20.  
  21. /*
  22.  *  Types.
  23.  */
  24.  
  25.  
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29.  
  30.  
  31. #ifndef EXPORT
  32. #ifdef WIN16
  33. #define EXPORT __export
  34. #else
  35. /* Additional special definitions here */
  36. #define EXPORT
  37. #endif
  38. #endif
  39.  
  40. typedef unsigned long FAR * LPULONG;
  41. typedef unsigned long       FLAGS;
  42.  
  43. #ifndef __LHANDLE
  44. #define __LHANDLE
  45. typedef unsigned long       LHANDLE, FAR * LPLHANDLE;
  46. #endif
  47.  
  48. typedef unsigned char FAR * LPBYTE;
  49.  
  50. #define    lhSessionNull    ((LHANDLE)0)
  51.  
  52. typedef struct
  53. {
  54.     ULONG ulReserved;            /* Reserved for future use (must be 0)     */
  55.     ULONG flFlags;               /* Flags                                   */
  56.     ULONG nPosition;             /* character in text to be replaced by attachment */
  57.     LPSTR lpszPathName;          /* Full path name of attachment file       */
  58.     LPSTR lpszFileName;          /* Original file name (optional)           */
  59.     LPVOID lpFileType;           /* Attachment file type (can be lpMapiFileTagExt) */
  60. } MapiFileDesc, FAR * lpMapiFileDesc;
  61.  
  62. #define MAPI_OLE                0x00000001
  63. #define MAPI_OLE_STATIC         0x00000002
  64.  
  65.  
  66. typedef struct
  67. {
  68.     ULONG ulReserved;           /* Reserved, must be zero.                  */
  69.     ULONG cbTag;                /* Size (in bytes) of                       */
  70.     LPBYTE lpTag;               /* X.400 OID for this attachment type       */
  71.     ULONG cbEncoding;           /* Size (in bytes) of                       */
  72.     LPBYTE lpEncoding;          /* X.400 OID for this attachment's encoding */
  73. } MapiFileTagExt, FAR *lpMapiFileTagExt;
  74.  
  75.  
  76. typedef struct
  77. {
  78.     ULONG ulReserved;           /* Reserved for future use                  */
  79.     ULONG ulRecipClass;         /* Recipient class                          */
  80.                                 /* MAPI_TO, MAPI_CC, MAPI_BCC, MAPI_ORIG    */
  81.     LPSTR lpszName;             /* Recipient name                           */
  82.     LPSTR lpszAddress;          /* Recipient address (optional)             */
  83.     ULONG ulEIDSize;            /* Count in bytes of size of pEntryID       */
  84.     LPVOID lpEntryID;           /* System-specific recipient reference      */
  85. } MapiRecipDesc, FAR * lpMapiRecipDesc;
  86.  
  87. #ifndef MAPI_ORIG               /* also defined in mapix.h */
  88. #define MAPI_ORIG   0           /* Recipient is message originator          */
  89. #define MAPI_TO     1           /* Recipient is a primary recipient         */
  90. #define MAPI_CC     2           /* Recipient is a copy recipient            */
  91. #define MAPI_BCC    3           /* Recipient is blind copy recipient        */
  92. #endif
  93.  
  94. typedef struct
  95. {
  96.     ULONG ulReserved;             /* Reserved for future use (M.B. 0)       */
  97.     LPSTR lpszSubject;            /* Message Subject                        */
  98.     LPSTR lpszNoteText;           /* Message Text                           */
  99.     LPSTR lpszMessageType;        /* Message Class                          */
  100.     LPSTR lpszDateReceived;       /* in YYYY/MM/DD HH:MM format             */
  101.     LPSTR lpszConversationID;     /* conversation thread ID                 */
  102.     FLAGS flFlags;                /* unread,return receipt                  */
  103.     lpMapiRecipDesc lpOriginator; /* Originator descriptor                  */
  104.     ULONG nRecipCount;            /* Number of recipients                   */
  105.     lpMapiRecipDesc lpRecips;     /* Recipient descriptors                  */
  106.     ULONG nFileCount;             /* # of file attachments                  */
  107.     lpMapiFileDesc lpFiles;       /* Attachment descriptors                 */
  108. } MapiMessage, FAR * lpMapiMessage;
  109.  
  110. #define MAPI_UNREAD             0x00000001
  111. #define MAPI_RECEIPT_REQUESTED  0x00000002
  112. #define MAPI_SENT               0x00000004
  113.  
  114.  
  115. /*
  116.  *  Entry points.
  117.  */
  118.  
  119. /*
  120.  *  flFlags values for Simple MAPI entry points. All documented flags are
  121.  *  shown for each call. Duplicates are commented out but remain present
  122.  *  for every call.
  123.  */
  124.  
  125. /* MAPILogon() flags.       */
  126.  
  127. #define MAPI_LOGON_UI           0x00000001  /* Display logon UI             */
  128. #ifndef MAPI_PASSWORD_UI
  129. #define MAPI_PASSWORD_UI        0x00020000  /* prompt for password only     */
  130. #endif
  131. #define MAPI_NEW_SESSION        0x00000002  /* Don't use shared session     */
  132. #define MAPI_FORCE_DOWNLOAD     0x00001000  /* Get new mail before return   */
  133. #define MAPI_EXTENDED           0x00000020  /* Extended MAPI Logon          */
  134.  
  135. /* MAPISendMail() flags.    */
  136.  
  137. /* #define MAPI_LOGON_UI        0x00000001     Display logon UI             */
  138. /* #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     */
  139.  
  140. #ifndef MAPI_DIALOG             /* also defined in property.h */
  141. #define MAPI_DIALOG             0x00000008  /* Display a send note UI       */
  142. #endif
  143. /*# define MAPI_USE_DEFAULT     0x00000040     Use default profile in logon */
  144.  
  145. /* MAPIFindNext() flags.    */
  146.  
  147. #define MAPI_UNREAD_ONLY        0x00000020  /* Only unread messages         */
  148. #define MAPI_GUARANTEE_FIFO     0x00000100  /* use date order               */
  149. #define MAPI_LONG_MSGID         0x00004000  /* allow 512 char returned ID   */
  150.  
  151. /* MAPIReadMail() flags.    */
  152.  
  153. #define MAPI_PEEK               0x00000080  /* Do not mark as read.         */
  154. #define MAPI_SUPPRESS_ATTACH    0x00000800  /* header + body, no files      */
  155. #define MAPI_ENVELOPE_ONLY      0x00000040  /* Only header information      */
  156. #define MAPI_BODY_AS_FILE       0x00000200
  157.  
  158. /* MAPISaveMail() flags.    */
  159.  
  160. /* #define MAPI_LOGON_UI        0x00000001     Display logon UI             */
  161. /* #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     */
  162. /* #define MAPI_LONG_MSGID      0x00004000  /* allow 512 char returned ID   */
  163.  
  164. /* MAPIAddress() flags.     */
  165.  
  166. /* #define MAPI_LOGON_UI        0x00000001     Display logon UI             */
  167. /* #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     */
  168.  
  169. /* MAPIDetails() flags.     */
  170.  
  171. /* #define MAPI_LOGON_UI        0x00000001     Display logon UI             */
  172. /* #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     */
  173. #define MAPI_AB_NOMODIFY        0x00000400  /* Don't allow mods of AB entries */
  174.  
  175. /* MAPIResolveName() flags. */
  176.  
  177. /* #define MAPI_LOGON_UI        0x00000001     Display logon UI             */
  178. /* #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     */
  179. /* #define MAPI_DIALOG          0x00000008     Prompt for choices if ambiguous */
  180. /* #define MAPI_AB_NOMODIFY     0x00000400     Don't allow mods of AB entries */
  181.  
  182. typedef ULONG (FAR PASCAL MAPILOGON)(
  183.     ULONG ulUIParam,
  184.     LPSTR lpszProfileName,
  185.     LPSTR lpszPassword,
  186.     FLAGS flFlags,
  187.     ULONG ulReserved,
  188.     LPLHANDLE lplhSession
  189. );
  190. typedef MAPILOGON FAR *LPMAPILOGON;
  191. MAPILOGON MAPILogon;
  192.  
  193. typedef ULONG (FAR PASCAL MAPILOGOFF)(
  194.     LHANDLE lhSession,
  195.     ULONG ulUIParam,
  196.     FLAGS flFlags,
  197.     ULONG ulReserved
  198. );
  199. typedef MAPILOGOFF FAR *LPMAPILOGOFF;
  200. MAPILOGOFF MAPILogoff;
  201.  
  202.  
  203. typedef ULONG (FAR PASCAL MAPISENDMAIL)(
  204.     LHANDLE lhSession,
  205.     ULONG ulUIParam,
  206.     lpMapiMessage lpMessage,
  207.     FLAGS flFlags,
  208.     ULONG ulReserved
  209. );
  210. typedef MAPISENDMAIL FAR *LPMAPISENDMAIL;
  211. MAPISENDMAIL MAPISendMail;
  212.  
  213.  
  214. typedef ULONG (FAR PASCAL MAPISENDDOCUMENTS)(
  215.     ULONG ulUIParam,
  216.     LPSTR lpszDelimChar,
  217.     LPSTR lpszFilePaths,
  218.     LPSTR lpszFileNames,
  219.     ULONG ulReserved
  220. );
  221. typedef MAPISENDDOCUMENTS FAR *LPMAPISENDDOCUMENTS;
  222. MAPISENDDOCUMENTS MAPISendDocuments;
  223.  
  224.  
  225. typedef ULONG (FAR PASCAL MAPIFINDNEXT)(
  226.     LHANDLE lhSession,
  227.     ULONG ulUIParam,
  228.     LPSTR lpszMessageType,
  229.     LPSTR lpszSeedMessageID,
  230.     FLAGS flFlags,
  231.     ULONG ulReserved,
  232.     LPSTR lpszMessageID
  233. );
  234. typedef MAPIFINDNEXT FAR *LPMAPIFINDNEXT;
  235. MAPIFINDNEXT MAPIFindNext;
  236.  
  237. typedef ULONG (FAR PASCAL MAPIREADMAIL)(
  238.     LHANDLE lhSession,
  239.     ULONG ulUIParam,
  240.     LPSTR lpszMessageID,
  241.     FLAGS flFlags,
  242.     ULONG ulReserved,
  243.     lpMapiMessage FAR *lppMessage
  244. );
  245. typedef MAPIREADMAIL FAR *LPMAPIREADMAIL;
  246. MAPIREADMAIL MAPIReadMail;
  247.  
  248. typedef ULONG (FAR PASCAL MAPISAVEMAIL)(
  249.     LHANDLE lhSession,
  250.     ULONG ulUIParam,
  251.     lpMapiMessage lpMessage,
  252.     FLAGS flFlags,
  253.     ULONG ulReserved,
  254.     LPSTR lpszMessageID
  255. );
  256. typedef MAPISAVEMAIL FAR *LPMAPISAVEMAIL;
  257. MAPISAVEMAIL MAPISaveMail;
  258.  
  259. typedef ULONG (FAR PASCAL MAPIDELETEMAIL)(
  260.     LHANDLE lhSession,
  261.     ULONG ulUIParam,
  262.     LPSTR lpszMessageID,
  263.     FLAGS flFlags,
  264.     ULONG ulReserved
  265. );
  266. typedef MAPIDELETEMAIL FAR *LPMAPIDELETEMAIL;
  267. MAPIDELETEMAIL MAPIDeleteMail;
  268.  
  269. #ifndef _MAC
  270. typedef ULONG (EXPORT FAR PASCAL MAPIFREEBUFFER)(
  271.     LPVOID pv
  272. );
  273. typedef MAPIFREEBUFFER FAR *LPMAPIFREEBUFFER;
  274. MAPIFREEBUFFER MAPIFreeBuffer;
  275. #endif
  276.  
  277. typedef ULONG (FAR PASCAL MAPIADDRESS)(
  278.     LHANDLE lhSession,
  279.     ULONG ulUIParam,
  280.     LPSTR lpszCaption,
  281.     ULONG nEditFields,
  282.     LPSTR lpszLabels,
  283.     ULONG nRecips,
  284.     lpMapiRecipDesc lpRecips,
  285.     FLAGS flFlags,
  286.     ULONG ulReserved,
  287.     LPULONG lpnNewRecips,
  288.     lpMapiRecipDesc FAR *lppNewRecips
  289. );
  290. typedef MAPIADDRESS FAR *LPMAPIADDRESS;
  291. MAPIADDRESS MAPIAddress;
  292.  
  293. typedef ULONG (FAR PASCAL MAPIDETAILS)(
  294.     LHANDLE lhSession,
  295.     ULONG ulUIParam,
  296.     lpMapiRecipDesc lpRecip,
  297.     FLAGS flFlags,
  298.     ULONG ulReserved
  299. );
  300. typedef MAPIDETAILS FAR *LPMAPIDETAILS;
  301. MAPIDETAILS MAPIDetails;
  302.  
  303. typedef ULONG (FAR PASCAL MAPIRESOLVENAME)(
  304.     LHANDLE lhSession,
  305.     ULONG ulUIParam,
  306.     LPSTR lpszName,
  307.     FLAGS flFlags,
  308.     ULONG ulReserved,
  309.     lpMapiRecipDesc FAR *lppRecip
  310. );
  311. typedef MAPIRESOLVENAME FAR *LPMAPIRESOLVENAME;
  312. MAPIRESOLVENAME MAPIResolveName;
  313.  
  314. #ifndef SUCCESS_SUCCESS
  315. #define SUCCESS_SUCCESS                 0
  316. #endif
  317. #define MAPI_USER_ABORT                 1
  318. #define MAPI_E_USER_ABORT               MAPI_USER_ABORT
  319. #define MAPI_E_FAILURE                  2
  320. #define MAPI_E_LOGON_FAILURE            3
  321. #define MAPI_E_LOGIN_FAILURE            MAPI_E_LOGON_FAILURE
  322. #define MAPI_E_DISK_FULL                4
  323. #define MAPI_E_INSUFFICIENT_MEMORY      5
  324. #define MAPI_E_ACCESS_DENIED            6
  325. #define MAPI_E_TOO_MANY_SESSIONS        8
  326. #define MAPI_E_TOO_MANY_FILES           9
  327. #define MAPI_E_TOO_MANY_RECIPIENTS      10
  328. #define MAPI_E_ATTACHMENT_NOT_FOUND     11
  329. #define MAPI_E_ATTACHMENT_OPEN_FAILURE  12
  330. #define MAPI_E_ATTACHMENT_WRITE_FAILURE 13
  331. #define MAPI_E_UNKNOWN_RECIPIENT        14
  332. #define MAPI_E_BAD_RECIPTYPE            15
  333. #define MAPI_E_NO_MESSAGES              16
  334. #define MAPI_E_INVALID_MESSAGE          17
  335. #define MAPI_E_TEXT_TOO_LARGE           18
  336. #define MAPI_E_INVALID_SESSION          19
  337. #define MAPI_E_TYPE_NOT_SUPPORTED       20
  338. #define MAPI_E_AMBIGUOUS_RECIPIENT      21
  339. #define MAPI_E_AMBIG_RECIP              MAPI_E_AMBIGUOUS_RECIPIENT
  340. #define MAPI_E_MESSAGE_IN_USE           22
  341. #define MAPI_E_NETWORK_FAILURE          23
  342. #define MAPI_E_INVALID_EDITFIELDS       24
  343. #define MAPI_E_INVALID_RECIPS           25
  344. #define MAPI_E_NOT_SUPPORTED            26
  345.  
  346.  
  347.  
  348. #ifdef MAPIX_H
  349. /*  Maps from a simple mapi session to a MAPI 1.0 extended mapi session */
  350.  
  351. STDMETHODIMP_(SCODE)
  352. ScMAPIXFromSMAPI(LHANDLE lhSimpleSession,
  353.                 ULONG ulFlags,
  354.                 LPCIID lpInterface,
  355.                 LPMAPISESSION FAR * lppMAPISession);
  356. #endif /* MAPIX_H */
  357.  
  358.  
  359. #ifdef  __cplusplus
  360. }       /*  extern "C" */
  361. #endif
  362.  
  363. #pragma option pop /*P_O_Pop*/
  364. #endif /* MAPI_H */
  365.