
Get the DLL path and name of the actual MAPI implementation.įGetComponentPath(g_szMapiComponentGUID, NULL, szMAPIDLL, MAX_PATH) The following example shows the previous steps: void InitializeMapiFunctions() Initialize the MAPI function pointer array by calling the GetProcAddress function.

Load the DLL by calling the LoadLibrary function. For more information, see Choose a Specific Version of MAPI to Load. PropertyĬall the FGetComponentPath function to get the path and DLL name that implements the MAPI subsystem. Load mapi32.dll from the appropriate system directory.

LPMAPIUNINITIALIZE pfnMAPIUninitialize = NULL Ĭreate a function that initializes MAPI functions to link to the MAPI DLL of the default MAPI client (for example, Msmapi32.dll of Microsoft Outlook). LPMAPIINITIALIZE pfnMAPIInitialize = NULL In your program file, create a global list of function pointers for each MAPI API element that you are using. To call MAPI API elements without the MAPI library and the Windows MAPI stub Like the implicit model, the new library manages everything and implements the explicit linking logic that loads Outlook's MAPI directly.įor more information about explicit linking, see Linking Explicitly. This information about explicit linking may be superfluous to your needs with the introduction of the MAPIStubLibrary.lib discussed in the following section. The following procedure shows how to call MAPI functions by using explicit linking.

The right side of the previous figure shows an example of a MAPI function call process, starting with a MAPI application looking for the path and DLL name for the Outlook MAPI stub (step 2 in the following section), and making function calls into the Outlook MAPI stub (step 3 in the following section). The process is initiated by a MAPI application and involves the MAPI library (Mapi32.lib) and the Windows MAPI stub (Mapi32.dll) and is completed by the Outlook MAPI client implementation of the MAPI stub (Msmapi32.dll).Ĭomparison of implicit and explicit linking.īecause the default MAPI client supports on-demand installation using the Windows Installer (MSI), you can develop messaging applications directly on the Outlook MAPI stub instead of using the MAPI library and Windows MAPI stub. The left side of the following figure shows an example of implicit linking used in a MAPI function call process. This call process is known as implicit linking. This included routing MAPI calls to the Windows MAPI stub library, Mapi32.dll, which then forwarded the calls to the default MAPI client implementation at run time. Historically, calling MAPI functions in a messaging application always involved linking to the Mapi32.lib library. There are three methods of linking: implicit linking, explicit linking, and a new hybrid model using the MAPI Stub Library.
