本文整理汇总了C++中LPADRBOOK::Address方法的典型用法代码示例。如果您正苦于以下问题:C++ LPADRBOOK::Address方法的具体用法?C++ LPADRBOOK::Address怎么用?C++ LPADRBOOK::Address使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPADRBOOK
的用法示例。
在下文中一共展示了LPADRBOOK::Address方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowAddressBook
// Shows the default Address Book dialog, return FALSE on failure, IDOK or IDCANCEL on success
// I force narrow strings here because it for some reason doesn't work in UNICODE
int CMAPIEx::ShowAddressBook(LPADRLIST& pAddressList, LPCTSTR szCaption)
{
#ifndef _WIN32_WCE
if(!m_pSession) return FALSE;
LPADRBOOK pAddressBook;
if(m_pSession->OpenAddressBook(0, NULL, 0, &pAddressBook)==S_OK)
{
pAddressList=NULL;
char* lppszDestTitles[]={ "To" };
ULONG lpulDestComps[]={ MAPI_TO };
ADRPARM adrparm;
memset(&adrparm, 0,sizeof(ADRPARM));
adrparm.ulFlags=DIALOG_MODAL | AB_RESOLVE;
adrparm.lpszCaption=(LPTSTR)szCaption;
#ifdef UNICODE
if(szCaption)
{
char szNarrowCaption[256];
WideCharToMultiByte(CP_ACP, 0, szCaption,-1, szNarrowCaption,255, NULL, NULL);
adrparm.lpszCaption=(LPTSTR)szNarrowCaption;
}
#endif
adrparm.cDestFields = 1;
adrparm.lppszDestTitles=(LPTSTR*)lppszDestTitles;
adrparm.lpulDestComps=lpulDestComps;
HWND hDesktop=::GetDesktopWindow();
HRESULT hr=pAddressBook->Address((ULONG_PTR*)&hDesktop, &adrparm, &pAddressList);
RELEASE(pAddressBook);
if(hr==S_OK) return IDOK;
if(hr==MAPI_E_USER_CANCEL) return IDCANCEL;
}
#endif
return FALSE;
}