O'Reilly logo

CDO & MAPI Programming with Visual Basic: by Dave Grundgeiger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Programmatically Discovering Whether MAPI Is Present

Application programs can examine the Windows registry to determine whether messaging components have been installed on the computer. The registry key used for this purpose is:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Messaging Subsystem

Table 2-4 shows the entry names to look for. A value of "1" for any entry means that the corresponding component is present on the computer.

Table 2-4. Registry Entries for Determining Whether Messaging Components are Installed

Messaging Component

Registry Entry Name

MAPI

"MAPIX"

Simple MAPI

"MAPI"

CMC

"CMC"

CDO

"OLEMessaging"

Your Visual Basic application has merely to check for these registry entries to determine whether specific messaging components have been installed. Unfortunately, the Visual Basic functions for registry access—SaveSetting, GetSetting, GetAllSettings, and DeleteSetting—are not flexible enough to retrieve data from arbitrary registry keys. Because checking for messaging components is potentially a useful feature, I’ll explain how to access arbitrary registry keys from Visual Basic. I’ll also give you a function that nicely wraps up the cumbersome stuff.

To access arbitrary registry entries, it is necessary to use the Win32 registry API functions RegOpenKeyEx, RegQueryValueEx, and RegCloseKey. Win32 API functions are made available to Visual Basic through Visual Basic’s Declare statement. The Declare statement specifies the name of the desired function, as well ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required