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