technologies based on MAPI, as Simple MAPI is, require that a MAPI
session be established prior to sending and receiving messages. MAPI
sessions were explained in Chapter 2. To establish
a MAPI session using Simple MAPI, call the
function, as shown here:
Dim nMAPISession As Long ' Initiate a MAPI session. nRetVal = MAPILogon(0, "MyProfile", "", MAPI_NEW_SESSION, _ 0, nMAPISession)
MAPILogon function has several parameters.
Declare statement looks like this:
Public Declare Function MAPILogon Lib "MAPI32.DLL" ( _ ByVal
UIParamAs Long, _ ByVal
UserAs String, _ ByVal
PasswordAs String, _ ByVal
FlagsAs Long, _ ByVal
ReservedAs Long, _
SessionAs Long _ ) As Long
The parameters to the
MAPILogon function are:
The handle of the window that is to be considered the parent of any dialog boxes displayed by MAPI during logon.
Depending on the values passed in the
Flags parameters, MAPI may need to
display a logon dialog box. Pass the hWnd property of a form to make
that form the parent window. Pass a
to indicate that any dialog boxes should be application-modal. If no
dialog box is displayed during logon,
UIParam is ignored.
This is the name of the profile that is to be used for the session.
(MAPI profiles were explained in Chapter 2.) To
cause MAPI to prompt the user for a profile to use, pass an empty
string in the
User parameter and specify
MAPI_LOGON_UI flag in the
Always pass an empty string ...