home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / MSINC.PAK / MAPI.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  12KB  |  370 lines

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