最近做的项目中需要实现把Outlook Express通讯录中的联系人数据导入到数据库中,以及把数据库中联系人数据保存为Outlook Express的.WAB文件。以前没做过,请高人们指点,最好提供例子,谢谢!

解决方案 »

  1.   

    windows中有个Wab32.dll,要操作wab文件要用这个。About Windows Address Book--------------------------------------------------------------------------------
    Microsoft® Windows® provides an address book for storing contact information. The Windows Address Book (WAB) is an application and service that enables users to keep track of people. The WAB has a local database and user interface for finding and editing information about people, and it can query network directory servers using Lightweight Directory Access Protocol (LDAP). Other applications can use the WAB. For example, Microsoft Outlook® uses the WAB as its e-mail address book.The following topics are discussed in this document.WAB Application
    Using the WAB API
    Related Topics
    WAB Application
    The Wab.exe program is included with Windows 98 and later. This address book application enables you to:Create contact entries.
    Store contact information locally.
    Search for entries in your contact database.
    Edit your contact information.
    Add contacts from e-mail messages. When you receive e-mail you can add the sender's contact information.
    Import contacts from other programs.
    When you invoke Wab.exe, it creates and searches the file named Username.wab which is found in the Application Data directory. For specific information on using the Wab.exe program, see the Knowledge Base Article Q164531 and the Electronic Mail section of the Windows 98 Resource Kit. Using the WAB API
    The WAB provides an application programming interface (API) that enables other applications to directly use its database and user interface services; therefore, you can write programs that include address books. The WAB API is based on MAPI, but the WAB does not use or require MAPI. The WAB interfaces support many of the methods used by MAPI, and because they inherit from IUnknown, they have the standard AddRef, Release, and QueryInterface methods. The WAB also has functions that provide access to the object interfaces.Registering Your Application to Use WAB
    If you want to use the WAB, you must register your application to use the Wab32.dll as a shared dynamic-link library (DLL). Registering Wab32.dll as a shared DLL prevents it from being inadvertently uninstalled while your application is running. To accomplish the registration, you must increment the reference count of the Wab32.dll in the SharedDLLs section of the registry.HKLM\Software\Microsoft\Windows\CurrentVersion\SharedDLLsThe steps to increment the reference count are:Find the path to the WAB DLL. 
    Look in the registry under: 
    HKLM\Software\Microsoft\WAB\DLLPathThe 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 include Wabapi.h in your application, use WAB_DLL_PATH_KEY as the name of the key to open.
    Find the WAB DLL path key. 
    Look in the registry under: 
    HKLM\Software\Microsoft\Windows\CurrentVersion\
    SharedDLLsFind the value <Full WAB32 Path>.
    Increment the reference count by one and save the incremented value back to the registry.
    WAB DLL path key not found. 
    If the value <Full WAB32 Path> does not exist, create the value using the Registry API. The value is a DWORD representing the number of clients registered to use the WAB.
    Increment the reference count by one and save the incremented value back to the registry.
    Loading the WAB32.dll
    With Microsoft Internet Explorer 4.0 or later, Wab32.dll is set in the registry at 
    HKLM\Software\Microsoft\WAB\DLLPath Load the DLL at run time only if the key is not in the registry, if the path set in the key is invalid, or if you are using a version of Internet Explorer earlier than Internet Explorer 4.0.If you need to load the DLL, call LoadLibrary.Creating an Instance of WAB
    To use WAB in your application, you must create and initialize the first instance of IWABObject. The following code sample demonstrates how to do this.Show ExampleLPWABOPEN lpfnWABOpen = NULL;  // Defined in Wabapi.h.
    HINSTANCE hinstWAB = NULL;// Initialize <tla rid="tla_wab" /> and get an instance
    // of IWABObject.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;
    }Related TopicsExtending the WAB Toolbar and Context Menu Actions
    Extending the WAB Property Sheets
    WAB and Multi-User/Multi-Identity Profiles
    UNICODE Support in WAB
    Importing and Exporting Named Properties Through vCards
    Windows Address Book Interfaces
    Windows Address Book Functions
    Windows Address Book Structures
    Windows Address Book Enumerated Typesmsdn中有相关的内容,自己看看吧。
      

  2.   

    我们公司作的时候,我用过的,不错!下载源代码修改一下。
    http://codecentral.borland.com/Item.aspx?id=22479
    http://shop33546080.taobao.com/享受生活。
      

  3.   

    delphi 官方给封装好了,我用过的,不错
      

  4.   

    yq3woaini(哈哈镜 http://shop33546080.taobao.com(选择好心情!) 我下载下来了,但是装不了,因为我一直都是用Delphi7开发的,它要求delphi9。