' ------------------------------------------------------------------------
'
'    MAPI32.TXT -- MAPI32 API Declarations for Visual Basic
'
'              Copyright (C) 1994-98 Microsoft Corporation
'
'
'  本文件只包含有关 MAPI32 API 的 Const、Type 和 Declare 语句。
'
'  如果您同意 Microsoft 对其内容没有任何保证、责任或义务的话，您有权免费用
'  任何方式使用、修改、复制和发布该文件（或任何的修改版本）。
'
' ------------------------------------------------------------------------

'***************************************************
'   MAPI 消息保存有关消息的信息
'***************************************************

Type MAPIMessage
    Reserved As Long
    Subject As String
    NoteText As String
    MessageType As String
    DateReceived As String
    ConversationID As String
    Flags As Long
    RecipCount As Long
    FileCount As Long
End Type


'**************************************************
'   MAPIRecip 保存有关某个消息的发信方 (originator)
'   或接受方 (recipient) 的信息
'**************************************************

Type MapiRecip
    Reserved As Long
    RecipClass As Long
    Name As String
    Address As String
    EIDSize As Long
    EntryID As String
End Type


'******************************************************
'   MapiFile 保存有关文件附件的信息
'******************************************************

Type MapiFile
    Reserved As Long
    Flags As Long
    Position As Long
    PathName As String
    FileName As String
    FileType As String
End Type


'***************************
'   函数 (FUNCTION) 声明
'***************************

Declare Function MAPILogon Lib "MAPI32.DLL" (ByVal UIParam&, ByVal User$, ByVal Password$, ByVal Flags&, ByVal Reserved&, Session&) As Long
Declare Function MAPILogoff Lib "MAPI32.DLL" (ByVal Session&, ByVal UIParam&, ByVal Flags&, ByVal Reserved&) As Long
Declare Function BMAPIReadMail Lib "MAPI32.DLL" (lMsg&, nRecipients&, nFiles&, ByVal Session&, ByVal UIParam&, MessageID$, ByVal Flag&, ByVal Reserved&) As Long
Declare Function BMAPIGetReadMail Lib "MAPI32.DLL" (ByVal lMsg&, Message As MAPIMessage, Recip() As MapiRecip, File() As MapiFile, Originator As MapiRecip) As Long
Declare Function MAPIFindNext Lib "MAPI32.DLL" Alias "BMAPIFindNext" (ByVal Session&, ByVal UIParam&, MsgType$, SeedMsgID$, ByVal Flag&, ByVal Reserved&, MsgID$) As Long
Declare Function MAPISendDocuments Lib "MAPI32.DLL" (ByVal UIParam&, ByVal DelimStr$, ByVal FilePaths$, ByVal FileNames$, ByVal Reserved&) As Long
Declare Function MAPIDeleteMail Lib "MAPI32.DLL" (ByVal Session&, ByVal UIParam&, ByVal MsgID$, ByVal Flags&, ByVal Reserved&) As Long
Declare Function MAPISendMail Lib "MAPI32.DLL" Alias "BMAPISendMail" (ByVal Session&, ByVal UIParam&, Message As MAPIMessage, Recipient() As MapiRecip, File() As MapiFile, ByVal Flags&, ByVal Reserved&) As Long
Declare Function MAPISaveMail Lib "MAPI32.DLL" Alias "BMAPISaveMail" (ByVal Session&, ByVal UIParam&, Message As MAPIMessage, Recipient() As MapiRecip, File() As MapiFile, ByVal Flags&, ByVal Reserved&, MsgID$) As Long
Declare Function BMAPIAddress Lib "MAPI32.DLL" (lInfo&, ByVal Session&, ByVal UIParam&, Caption$, ByVal nEditFields&, Label$, nRecipients&, Recip() As MapiRecip, ByVal Flags&, ByVal Reserved&) As Long
Declare Function BMAPIGetAddress Lib "MAPI32.DLL" (ByVal lInfo&, ByVal nRecipients&, Recipients() As MapiRecip) As Long
Declare Function MAPIDetails Lib "MAPI32.DLL" Alias "BMAPIDetails" (ByVal Session&, ByVal UIParam&, Recipient As MapiRecip, ByVal Flags&, ByVal Reserved&) As Long
Declare Function MAPIResolveName Lib "MAPI32.DLL" Alias "BMAPIResolveName" (ByVal Session&, ByVal UIParam&, ByVal UserName$, ByVal Flags&, ByVal Reserved&, Recipient As MapiRecip) As Long



'**************************
'   常数 (CONSTANT) 声明
'**************************
'

Const SUCCESS_SUCCESS = 0
Const MAPI_USER_ABORT = 1
Const MAPI_E_USER_ABORT = MAPI_USER_ABORT
Const MAPI_E_FAILURE = 2
Const MAPI_E_LOGIN_FAILURE = 3
Const MAPI_E_LOGON_FAILURE = MAPI_E_LOGIN_FAILURE
Const MAPI_E_DISK_FULL = 4
Const MAPI_E_INSUFFICIENT_MEMORY = 5
Const MAPI_E_BLK_TOO_SMALL = 6
Const MAPI_E_TOO_MANY_SESSIONS = 8
Const MAPI_E_TOO_MANY_FILES = 9
Const MAPI_E_TOO_MANY_RECIPIENTS = 10
Const MAPI_E_ATTACHMENT_NOT_FOUND = 11
Const MAPI_E_ATTACHMENT_OPEN_FAILURE = 12
Const MAPI_E_ATTACHMENT_WRITE_FAILURE = 13
Const MAPI_E_UNKNOWN_RECIPIENT = 14
Const MAPI_E_BAD_RECIPTYPE = 15
Const MAPI_E_NO_MESSAGES = 16
Const MAPI_E_INVALID_MESSAGE = 17
Const MAPI_E_TEXT_TOO_LARGE = 18
Const MAPI_E_INVALID_SESSION = 19
Const MAPI_E_TYPE_NOT_SUPPORTED = 20
Const MAPI_E_AMBIGUOUS_RECIPIENT = 21
Const MAPI_E_AMBIG_RECIP = MAPI_E_AMBIGUOUS_RECIPIENT
Const MAPI_E_MESSAGE_IN_USE = 22
Const MAPI_E_NETWORK_FAILURE = 23
Const MAPI_E_INVALID_EDITFIELDS = 24
Const MAPI_E_INVALID_RECIPS = 25
Const MAPI_E_NOT_SUPPORTED = 26

Const MAPI_ORIG = 0
Const MAPI_TO = 1
Const MAPI_CC = 2
Const MAPI_BCC = 3


'***********************
'   标志 (FLAG) 声明
'***********************

'* MAPILogon() 标志 *

Const MAPI_LOGON_UI = &H1
Const MAPI_NEW_SESSION = &H2
Const MAPI_FORCE_DOWNLOAD = &H1000

'* MAPILogoff() 标志 *

Const MAPI_LOGOFF_SHARED = &H1
Const MAPI_LOGOFF_UI = &H2

'* MAPISendMail() 标志 *

Const MAPI_DIALOG = &H8

'* MAPIFindNext() 标志 *

Const MAPI_UNREAD_ONLY = &H20
Const MAPI_GUARANTEE_FIFO = &H100

'* MAPIReadMail() 标志 *

Const MAPI_ENVELOPE_ONLY = &H40
Const MAPI_PEEK = &H80
Const MAPI_BODY_AS_FILE = &H200
Const MAPI_SUPPRESS_ATTACH = &H800

'* MAPIDetails() 标志 *

Const MAPI_AB_NOMODIFY = &H400

'* Attachment 标志 *

Const MAPI_OLE = &H1
Const MAPI_OLE_STATIC = &H2

'* MapiMessage 标志 *

Const MAPI_UNREAD = &H1
Const MAPI_RECEIPT_REQUESTED = &H2
Const MAPI_SENT = &H4
