怎样打开Windows address book?

rolt 2000-06-25 09:40:00
我想在程序中调用微软的通讯簿(wab),怎么做?
...全文
1453 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunsetyang 2000-06-26
  • 打赏
  • 举报
回复
这个的专题可以参考MSDN中Platform SDK中的MAPI部分。一下来自MSDN:
Implementation Tasks
To search the entire address book by display name for one or more entries

Use the IAddrBook::ResolveName method. You can optionally request a dialog box that prompts the user to choose the correct entry in case the information you were given matches more than one entry.
To open the user's personal address book (PAB)

Retrieve its entry identifier by calling the IAddrBook::GetPAB method.
Call the IAddrBook::OpenEntry method passing the PAB's entry identifier.
To open a specific container other than the PAB

Open the address book's root container by calling the IAddrBook::OpenEntry method with a NULL entry identifier. The root container is constructed by MAPI and contains the top-level containers of all the address book providers in the profile.
Get the list of top-level containers by calling the IMAPIContainer::GetHierarchyTable method.
If you want a specific container type such as the global address list, restrict the table on PR_DISPLAY_TYPE:
Create a property restriction to match PR_DISPLAY_TYPE with the value for the particular type of container you want to open. For example, to open the global address book, build a property restriction that matches PR_DISPLAY_TYPE with the DT_GLOBAL value.
d. Call the IAddrBook::OpenEntry method with the PR_ENTRYID column from the row you want to open the container.

Create an SPropTagArray including PR_ENTRYID, PR_DISPLAY_TYPE, and any other columns of interest.
Call the HrQueryAllRows function passing your property tag array and restriction. Ordinarily, there will be a single global address list, but the call can return zero, one, or more rows depending on the address book providers in your profile. Be prepared to handle all these cases, not just one row.



If you want a container belonging to a specific address book provider, restrict the table on PR_AB_PROVIDER_ID:
Create a property restriction to match PR_AB_PROVIDER_ID with the value that represents the target address book provider. You will find this property value in a header file created by the service provider. In the Platform SDK, for instance, the value for the flat file address book sample is SAB_PROVIDER_ID in SMPAB.H.
Create an SPropTagArray structure including PR_ENTRYID, PR_AB_PROVIDER_ID, and any other columns of interest.
Call the HrQueryAllRows function passing your property tag array and restriction. The call will return zero rows if the provider you want is not in the profile. It can return one or more rows depending on the provider's containers are organized, but it will only return the top-level rows.
Call the IAddrBook::OpenEntry method with the PR_ENTRYID column from the row you want to open the container. If the container you want is not a top-level container, you will then have to navigate down through the latter's hierarchy table.
To search in a specific address book container

Open its contents table by calling its GetContentsTable method.
Use IMAPITable::FindRow, IMAPITable::SortTable, and IMAPITable::Restrict to search the contents table just as you can any MAPI table. See Table Positioning and About Restrictions. These methods are subject to limitations in the provider's implementation, and their speed is unpredictable; careful testing against any providers you expect to use is indispensible. In addition to the normal IMAPITable methods, there are two search techniques specific to address book containers:
Restriction on PR_ANR (ambiguous name resolution). Although formatted as an ordinary SPropertyRestriction structure, this restriction actually invokes a special display name matching algorithm based on separating the string you give it into words and prefix-matching those words against display names in the address book. See Implementing Name Resolution.
IABContainer::ResolveNames. This method does the same work as a PR_ANR restriction for multiple names, and can be much faster. Providers are not required to implement it, and generally do not unless it carries a significant performance benefit. It is not necessary to open the contents table in order to user this method.
After applying any of the restriction methods listed above, call the IMAPITable::QueryRows method to retrieve any rows that match the restriction. You may get back zero, one, or more rows that match.
Retrieve additional information for a single address book entry by calling the IAddrBook::OpenEntry method passing its entry identifier, then call GetProps on the resulting IMAPIProp interface. To retrieve additional properties for multiple address book entries, you can of course call OpenEntry for each one, but it is usually much more efficient to call the IAddrBook::PrepareRecips method. PrepareRecips requires an ADRLIST structure.
rolt 2000-06-26
  • 打赏
  • 举报
回复
我要调的不是exe,是引用通讯簿的数据库,类似DAO方式的
我知道有CDO,但是微软的例子很少
土豆 2000-06-26
  • 打赏
  • 举报
回复
如果仅仅是想在程序中调用通讯簿的话,用不着这么麻烦,用ShellExcute就可以了:
ShellExecute(parantHandle, NULL, "C:\\Program Files\\Outlook Express\\wab.exe", NULL, NULL, SW_SHOWNORMAL);

通过存取 IAddrBook 接口是实现存取通讯录的数据。

Yellowmoon 2000-06-25
  • 打赏
  • 举报
回复
不凡用WinExec(exename)试一试.函数名可能不太准确,查帮助吧

16,466

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧