Internet Explorer Address BookInternet Explorer Address Book*
*



Contents  *



Index  *Topic Contents
*Previous Topic: TYPELIB
*Next Topic: Internet Explorer Address Book Interfaces

Internet Explorer Address Book

Microsoft® Internet Explorer Address Book is an application and service that helps users keep track of people. It has a local database and a user interface for finding and editing information about people, and it can perform queries against network directory servers using the Internet-standard (LDAP) protocol. There are two ways users can access the Address Book from the Start Menu. They can select Programs, select Internet Explorer, and then select Address Book, or they can select Find and then select People. Other applications can also use Internet Explorer Address Book. For example, Microsoft Outlook Express uses Internet Explorer Address Book as its e-mail address book. Internet Explorer Address Book offers interfaces that enable other applications to directly use its database and its user interface services.

For more information on Internet Explorer Address Book, please see:

bulletInternet Explorer Address Book File Location

bulletInterfaces

bulletFunctions

bulletStructures

Internet Explorer Address Book Files and Locations

The collection of interfaces available to the developer from Internet Explorer Address Book represents the programmatic techniques necessary to implement the functionality of Internet Explorer Address Book.

Registering Internet Explorer Address Book

If you plan to have your application use Internet Explorer Address Book, your application must register itself for using the Wab32.dll as a shared DLL. This will prevent the Wab32.dll from being inadvertently uninstalled while your application is still using it. To do this, you need to increment the reference count of the Wab32.dll in the SharedDLLs section in the registry under HKLM\Software\Microsoft\Windows\CurrentVersion\SharedDLLs.

First get the full path of the installed Wab32.dll from:

HKLM\Software\Microsoft\WAB\DLLPath

The default value under this key gives the path of any WAB DLL installed on the computer. (This DLL path is defined in Wabapi.h as WAB_DLL_PATH_KEY; if you are including Wabapi.h in your application, just use the defined WAB_DLL_PATH_KEY symbol as the name of the key to open.) If this key does not exist, the system has a pre-Internet Explorer 4.0 version of Internet Explorer Address Book and you do not need to do any reference counting on the DLL.

If the above key exists, look under:

HKLM\Software\Microsoft\Windows\CurrentVersion\SharedDLLs

Look for the value of <Full WAB32 Path>. If this value doesn't exist, create it using the registry API. This is a DWORD value. The content of this value is a reference count representing the number of clients registered to use Internet Explorer Address Book. You should read the reference count from the value, increment it by one, and then save the incremented value back to the registry.

Loading Wab32.dll at Run Time

On systems that have Internet Explorer 3.0x or earlier, the Wab32.dll file exists in the windows\system directory. However, on Internet Explorer 4.0 and later platforms, Wab32.dll exists elsewhere, and your application cannot assume it will be able to load the DLL by just using LoadLibrary("wab32.dll"). You should also not statically link your application to Wab32.dll because it might not necessarily be on the path.

Under Internet Explorer 4.0, Wab32.dll is set in the registry in the following location:

HKLM\Software\Microsoft\WAB\DLLPath

The only reason to call LoadLibrary("wab32.dll") is if this key does not exist or if the path set in this key is invalid.

The following sample code shows how to run LoadLibrary on Internet Explorer Address Book.

const static TCHAR lpszWABRegPathKey[] = TEXT("Software\\Microsoft\\WAB\\DLLPath");
const static TCHAR lpszWABDll[] = TEXT("WAB32.dll");

// GetWABDllPath - loads the WAB DLL path from the registry
// szPath - ptr to buffer
// cb - sizeof buffer
//
void GetWABDllPath(LPTSTR szPath, ULONG cb)
{
    DWORD  dwType = 0;
    ULONG  cbData = cb;
    HKEY hKey = NULL;
    if(szPath)
    {
        *szPath = '\0';
        if (ERROR_SUCCESS == RegOpenKeyEx( HKEY_LOCAL_MACHINE,
            lpszWABRegPathKey, 0, KEY_READ, &hKey))
            RegQueryValueEx( hKey, "", NULL, &dwType, (LPBYTE) szPath, &cbData);
    }
    if(hKey) RegCloseKey(hKey);
    return;
}

// LoadLibrary_WABDll() - Load the WAB library based on the WAB DLL path
//
HINSTANCE LoadLibrary_WABDll()
{
    TCHAR  szWABDllPath[MAX_PATH];
    HINSTANCE hinst = NULL;

    GetWABDllPath(szWABDllPath, sizeof(szWABDllPath));

    return(hinst = LoadLibrary( (lstrlen(szWABDllPath)) ? szWABDllPath : lpszWABDll ));
}

Creating an Instance of Internet Explorer Address Book

To create and initialize the first instance of Internet Explorer Address Book, use the following sample code as a guide.

LPWABOPEN lpfnWABOpen = NULL;   // defined in WABAPI.H
HINSTANCE hinstWAB = NULL; 
//
// Initialize Internet Explorer Address Book and get an instance of IWABObject and IAddrBook
//
HRESULT InitWAB(LPWABOBJECT * lppWABObject,
   LPADRBOOK * lppAdrBook)
{
    HRESULT hr = E_FAIL; 
    hinstWAB = LoadLibrary_WABDll(); 
  if(hinstWAB)
    {
    lpfnWABOpen = (LPWABOPEN) GetProcAddress(hinstWAB, "WABOpen");
  if(lpfnWABOpen)
    hr = lpfnWABOpen(lppAdrBook, lppWABObject, NULL, 0);
    }
 return hr;
}

Using Internet Explorer Address Book Files Under Internet Explorer 3.0x

In Internet Explorer 3.0x installations, the default location of Wab32.dll is in the Windows system directory.

<Windows System Directory>\WAB32.dll

When Internet Explorer 4.0 is installed, the file Wab32.dll is renamed Wab32.ie3 so the old version of the file will not conflict with the newer versions installed by Internet Explorer 4.0 setup. Should it become necessary to uninstall, the old files are given back their original names so that users can revert back to their exact pre-Internet Explorer 4.0 settings.

An application that will be working with Wab32.dll under both Internet Explorer 4.0 and Internet Explorer 3.0x should not rely on being able to find Wab32.dll on the path. To see how you can write a single piece of code that can load the WAB32.dll library under both Internet Explorer 4.0 and Internet Explorer 3.0, refer to the sample code from the previous section, Loading Wab32.dll at Run Time.


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.