本文整理汇总了C++中LPADRBOOK::GetPAB方法的典型用法代码示例。如果您正苦于以下问题:C++ LPADRBOOK::GetPAB方法的具体用法?C++ LPADRBOOK::GetPAB怎么用?C++ LPADRBOOK::GetPAB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPADRBOOK
的用法示例。
在下文中一共展示了LPADRBOOK::GetPAB方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ImportWAB
void CProcessor::ImportWAB()
{
HINSTANCE hinstLib;
HRESULT hRes;
LPADRBOOK lpAdrBook;
LPWABOBJECT lpWABObject;
DWORD Reserved2 = NULL;
fWABOpen procWABOpen;
{
TCHAR szWABDllPath[MAX_PATH];
DWORD dwType = 0;
ULONG cbData = sizeof(szWABDllPath);
HKEY hKey = NULL;
*szWABDllPath = '\0';
// First we look under the default WAB DLL path location in the
// Registry.
// WAB_DLL_PATH_KEY is defined in wabapi.h
//
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, WAB_DLL_PATH_KEY, 0, KEY_READ, &hKey))
RegQueryValueEx( hKey, "", NULL, &dwType, (LPBYTE) szWABDllPath, &cbData);
if(hKey) RegCloseKey(hKey);
// if the Registry came up blank, we do a loadlibrary on the wab32.dll
// WAB_DLL_NAME is defined in wabapi.h
//
hinstLib = LoadLibrary( (lstrlen(szWABDllPath)) ? szWABDllPath : WAB_DLL_NAME );
}
if (hinstLib != NULL)
{
procWABOpen = (fWABOpen) GetProcAddress(hinstLib, "WABOpen");
if (procWABOpen != NULL)
{
hRes = (procWABOpen)(&lpAdrBook,&lpWABObject,NULL,Reserved2); // WABOpen
_ASSERTE(hRes == S_OK);
if (hRes != S_OK) return;
ULONG lpcbEntryID;
ENTRYID *lpEntryID;
hRes = lpAdrBook->GetPAB(
&lpcbEntryID,
&lpEntryID
);
_ASSERTE(hRes == S_OK);
if (hRes != S_OK) return;
ULONG ulFlags = MAPI_BEST_ACCESS;
ULONG ulObjType = NULL;
LPUNKNOWN lpUnk = NULL;
hRes = lpAdrBook->OpenEntry(
lpcbEntryID,
lpEntryID,
NULL,
ulFlags,
&ulObjType,
&lpUnk
);
ulFlags = NULL;
//IABTable *lpTable;
if (ulObjType == MAPI_ABCONT)
{
IABContainer *lpContainer = static_cast <IABContainer *>(lpUnk);
LPMAPITABLE lpTable = NULL;
hRes = lpContainer->GetContentsTable(
ulFlags,
&lpTable
);
_ASSERT(lpTable);
ULONG ulRows, ulFound = 0, ulExisted = 0;
hRes = lpTable->GetRowCount(0,&ulRows);
_ASSERTE(hRes == S_OK);
SRowSet *lpRows;
hRes = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0 );
hRes = lpTable->QueryRows(
ulRows, // Get all Rows
0,
&lpRows
);
for(ULONG i=0;i<lpRows->cRows;i++)
{
bool bBirthdayProcessed = false;
CBirthday* pbd = new CBirthday;
SRow *lpRow = &lpRows->aRow[i];
for(ULONG j=0;j<lpRow->cValues;j++)
{
SPropValue *lpProp = &lpRow->lpProps[j];
if(lpProp->ulPropTag == PR_BIRTHDAY)
//.........这里部分代码省略.........
示例2: ReadWAB
BOOL ReadWAB(LPADRBOOK pAdrBook,
LPWABOBJECT pWABObject,
AdrBookTable **ppTable,
UINT *pNumEntries)
{
ULONG ulObjType = 0;
LPMAPITABLE lpAB = NULL;
LPTSTR * lppszArray=NULL;
ULONG cRows = 0;
LPSRowSet lpRow = NULL;
LPSRowSet lpRowAB = NULL;
LPABCONT lpContainer = NULL;
int cNumRows = 0;
int nRows=0;
int nCount = 0;
HRESULT hr = E_FAIL;
ULONG lpcbEID;
LPENTRYID lpEID = NULL;
// Get the entryid of the root PAB container
//
hr = pAdrBook->GetPAB( &lpcbEID, &lpEID);
ulObjType = 0;
// Open the root PAB container
// This is where all the WAB contents reside
//
hr = pAdrBook->OpenEntry(lpcbEID,
(LPENTRYID)lpEID,
NULL,
0,
&ulObjType,
(LPUNKNOWN *)&lpContainer);
pWABObject->FreeBuffer(lpEID);
lpEID = NULL;
if(HR_FAILED(hr))
goto exit;
// Get a contents table of all the contents in the
// WABs root container
//
hr = lpContainer->GetContentsTable( 0,
&lpAB);
if(HR_FAILED(hr))
goto exit;
// Order the columns in the ContentsTable to conform to the
// ones we want - which are mainly DisplayName, EntryID and
// ObjectType
// The table is gauranteed to set the columns in the order
// requested
//
hr =lpAB->SetColumns( (LPSPropTagArray)&ptaEid, 0 );
if(HR_FAILED(hr))
goto exit;
// Reset to the beginning of the table
//
hr = lpAB->SeekRow( BOOKMARK_BEGINNING, 0, NULL );
if(HR_FAILED(hr))
goto exit;
// Read all the rows of the table one by one
//
do {
hr = lpAB->QueryRows(1, 0, &lpRowAB);
if(HR_FAILED(hr))
break;
if(lpRowAB)
{
cNumRows = lpRowAB->cRows;
if (cNumRows)
{
LPTSTR szName = lpRowAB->aRow[0].lpProps[ieidPR_DISPLAY_NAME].Value.lpszA;
LPTSTR szEmail = NULL;
LPENTRYID lpEID = (LPENTRYID) lpRowAB->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
ULONG cbEID = lpRowAB->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
LPMAILUSER pMailUser = NULL;
ULONG ulObjType = 0;
ULONG ulValues;
LPSPropValue lpPropArray;
*ppTable = (AdrBookTable *) realloc(*ppTable,
sizeof(AdrBookTable) * (nCount+1));
(*ppTable)[nCount].szName =
//.........这里部分代码省略.........