Click here to Skip to main content
15,891,828 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how we get the path of a file Pin
Hamid_RT30-Jun-06 2:42
Hamid_RT30-Jun-06 2:42 
AnswerRe: how we get the path of a file [modified] Pin
_AnsHUMAN_ 30-Jun-06 0:56
_AnsHUMAN_ 30-Jun-06 0:56 
GeneralHelp me Pin
happy_ram30-Jun-06 1:37
happy_ram30-Jun-06 1:37 
AnswerRe: how we get the path of a file Pin
David Crow30-Jun-06 2:34
David Crow30-Jun-06 2:34 
GeneralRe: how we get the path of a file Pin
happy_ram30-Jun-06 2:37
happy_ram30-Jun-06 2:37 
GeneralRe: how we get the path of a file Pin
Maximilien30-Jun-06 2:47
Maximilien30-Jun-06 2:47 
Questionsnapshot from webcam [modified] Pin
V_shr30-Jun-06 0:25
V_shr30-Jun-06 0:25 
QuestionWAB HomeNumber Pin
Tili30-Jun-06 0:25
Tili30-Jun-06 0:25 
Hi
I have read a lot of articles and researched on internet but I haven't found a way to get HomeTelephoneNumber from WAB. I can get DISPLAY_NAME and EMAIL_ADDRESS but not PR_PRIMARY_TELEPHONE_NUMBER_A

This is the code
<br />
int main(int argc, char* argv[])<br />
{<br />
	//Opens the default WAB file in the system and loads it into the object<br />
	HINSTANCE hinstWAB=NULL;<br />
	HRESULT hr=E_FAIL;<br />
	<br />
	HKEY keyResult;<br />
	BYTE keyValue[MAX_PATH];<br />
	DWORD dataout=800;<br />
	char PathToWAB[255];<br />
<br />
	RegOpenKeyEx(HKEY_LOCAL_MACHINE, WAB_DLL_PATH_KEY, 0, KEY_ALL_ACCESS, &keyResult); //"Software\\Microsoft\\WAB\\DLLPath"<br />
	long result = RegQueryValueEx(keyResult, "", 0, 0, keyValue, &dataout);<br />
	RegCloseKey(keyResult);<br />
<br />
	//Get the full path of WAB and store in PathToWAB<br />
	strcpy(PathToWAB, (char*)keyValue);<br />
<br />
	//Now let us load the library<br />
	HMODULE hModule = LoadLibrary(PathToWAB);<br />
<br />
	if (hModule!=NULL)<br />
		{<br />
			//We're safe the module was initialzised let's do what we need to do<br />
			ssWABOpen = (fWABOpen)GetProcAddress(hModule, "WABOpen");<br />
			//If not successful throw an error throw the value = 2<br />
			if (ssWABOpen == NULL) return 2;<br />
			//It is successful call it<br />
			HRESULT hr = (ssWABOpen)(&lpAddrBook, &lpWABObject, NULL, 0);<br />
		}<br />
<br />
<br />
	 // LoadEmails<br />
	hr = E_FAIL;<br />
<br />
	if (ssWABOpen==NULL) return 1; //ssWABOpen cannot be NULL<br />
	{<br />
		ULONG lpcbEntryID;<br />
		ENTRYID* lpEntryID;<br />
<br />
		hr = lpAddrBook->GetPAB(&lpcbEntryID, &lpEntryID);<br />
		if (hr!=S_OK) return 10; //error opening the darn PAB<br />
		<br />
		//Declare variables for MAPI and specific access to the PAB<br />
		ULONG ulFlags = MAPI_BEST_ACCESS,<br />
			  ulObjType = NULL;<br />
		LPUNKNOWN lpIUnknown = NULL;<br />
		hr = lpAddrBook->OpenEntry(lpcbEntryID,<br />
								   lpEntryID,<br />
								   NULL,<br />
								   ulFlags,<br />
								   &ulObjType,<br />
								   &lpIUnknown);<br />
<br />
		ulFlags = NULL; //We are using it again :)<br />
<br />
		if (ulObjType==MAPI_ABCONT) //See if an address book container was passed which we are looking for<br />
		{<br />
			IABContainer* lpABContainer = static_cast<IABContainer*>(lpIUnknown); //cast the IUnknown pointer returned from previous function to what we need<br />
			LPMAPITABLE lpMAPItbl = NULL;<br />
			hr = lpABContainer->GetContentsTable(ulFlags, &lpMAPItbl);<br />
			if(!lpMAPItbl)<br />
			{<br />
				printf("Error in lpMAPItbl\n");<br />
				return 0;<br />
			}<br />
//			ASSERT(lpMAPItbl);<br />
<br />
			SPropTagArray *propTag;<br />
//			memset(propTag,0,sizeof(propTag));<br />
			hr = lpMAPItbl->QueryColumns(TBL_ALL_COLUMNS,(LPSPropTagArray*)&propTag);<br />
<br />
			for(int j=0;j<propTag->cValues;j++)<br />
			{<br />
				<br />
				printf("(%d)\n",propTag->aulPropTag[j]);<br />
			}<br />
//			MAPIFreeBuffer(propTag);<br />
			ULONG ulRows; //Number of rows in the MAPI table (Addresses)<br />
			hr = lpMAPItbl->GetRowCount(0, &ulRows);<br />
				if (hr!=S_OK) return 11; //Return 11 to tell them we where unable to get the row count<br />
			<br />
			SRowSet* lpRowSet;<br />
			hr = lpMAPItbl->QueryRows(		//Return all the rows found in the address book<br />
									ulRows,<br />
									0,<br />
									&lpRowSet);<br />
			<br />
			//Grow variable<br />
//			AddrMemBook.resize(lpRowSet->cRows);<br />
			//char Match[200]; strset(Match, 0);<br />
<br />
			for (ULONG x = 0; x < lpRowSet->cRows; x++) <br />
			{<br />
				//Loop through all the rows and add it to our address book<br />
				//vector variable<br />
				EMAILS thisAddr;											<br />
				memset(&thisAddr,0,sizeof(thisAddr));<br />
				SRow* lpRow = &lpRowSet->aRow[x]; //Get this specific row<br />
				for (ULONG y = 0; y < lpRow->cValues; y++)<br />
				{<br />
					//Loop through the fields in the address book and assign<br />
					//to our variable and put it in the address book variable					<br />
					SPropValue* lPropVal = &lpRow->lpProps[y];<br />
//					if(strlen(lPropVal->Value.lpszA)<200)<br />
					lPropVal->Value.lpszA;<br />
					ADRLIST adrl;<br />
					adrl.cEntries = 1;<br />
					adrl.aEntries[0].cValues = lpRow->cValues;<br />
					adrl.aEntries[0].rgPropVals = lPropVal;<br />
<br />
					SPropTagArray propTag;<br />
					propTag.cValues = 1;<br />
					propTag.aulPropTag[0] = PR_HOME_TELEPHONE_NUMBER_A;<br />
<br />
//					hr = lpAddrBook->PrepareRecips(NULL,&propTag,&adrl);<br />
					printf("(%x)",lPropVal->ulPropTag);<br />
					switch (lPropVal->ulPropTag)<br />
					{<br />
					case PR_DISPLAY_NAME_A:		<br />
						strncpy(thisAddr.DisplayName,lPropVal->Value.lpszA,sizeof(thisAddr.DisplayName));<br />
						//strcpy(thisAddr->DisplayName, lPropVal->Value.lpszA);<br />
						break;<br />
<br />
					case PR_ADDRTYPE_A:						<br />
						strncpy(thisAddr.EmailAddr,lPropVal->Value.lpszA,sizeof(thisAddr.EmailAddr));<br />
//						if (strchr(thisAddr.EmailAddr, '@')==NULL) //replace with empty string<br />
//							thisAddr.EmailAddr='\0';<br />
						//strcpy(thisAddr->EmailAddr, lPropVal->Value.lpszA);						<br />
						break;<br />
<br />
					case PR_PRIMARY_TELEPHONE_NUMBER_A:<br />
						strncpy(thisAddr.NickName,lPropVal->Value.lpszA,sizeof(thisAddr.NickName));<br />
						//strcpy(thisAddr->NickName, lPropVal->Value.lpszA);<br />
						break;<br />
<br />
					default:<br />
						break;<br />
					}<br />
<br />
				}//End of cycling through fields<br />
				//Add the information to the vector variable				<br />
//				if (!thisAddr.EmailAddr.empty()) <br />
//					AddrMemBook.push_back(thisAddr);<br />
				printf("%s\t%s\t%s\n",thisAddr.DisplayName,thisAddr.EmailAddr,thisAddr.NickName);<br />
<br />
				lpWABObject->FreeBuffer(lpRow);<br />
<br />
			}//End of cycling through rows<br />
			lpWABObject->FreeBuffer(lpRowSet);<br />
		}<br />
	}<br />
<br />
<br />
<br />
	FreeLibrary(hModule);<br />
    return 0;<br />
}<br />

Thanks in advance.

-----------------------------
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
AnswerRe: WAB HomeNumber Pin
Tili30-Jun-06 1:03
Tili30-Jun-06 1:03 
QuestionBasic question in C/ C++ Pin
Javagal Srinath30-Jun-06 0:11
Javagal Srinath30-Jun-06 0:11 
AnswerRe: Basic question in C/ C++ Pin
Kevin McFarlane30-Jun-06 0:32
Kevin McFarlane30-Jun-06 0:32 
AnswerRe: Basic question in C/ C++ [modified] Pin
Viorel.30-Jun-06 0:32
Viorel.30-Jun-06 0:32 
AnswerRe: Basic question in C/ C++ Pin
Sarath C30-Jun-06 0:36
Sarath C30-Jun-06 0:36 
QuestionHow to intercept screen arbitrarily? Pin
huaiguczx29-Jun-06 23:30
huaiguczx29-Jun-06 23:30 
AnswerRe: How to intercept screen arbitrarily? Pin
Ivy_Venkat29-Jun-06 23:34
Ivy_Venkat29-Jun-06 23:34 
AnswerRe: How to intercept screen arbitrarily? Pin
David Crow30-Jun-06 2:37
David Crow30-Jun-06 2:37 
QuestionHow to Replace a line in a .TXT file Pin
zxc8929-Jun-06 23:17
zxc8929-Jun-06 23:17 
AnswerRe: How to Replace a line in a .TXT file Pin
Ivy_Venkat29-Jun-06 23:27
Ivy_Venkat29-Jun-06 23:27 
QuestionRe: How to Replace a line in a .TXT file Pin
David Crow30-Jun-06 2:40
David Crow30-Jun-06 2:40 
AnswerRe: How to Replace a line in a .TXT file Pin
Stephen Hewitt30-Jun-06 4:03
Stephen Hewitt30-Jun-06 4:03 
QuestionGetPixel intercept [modified] Pin
Venkat_Ivy29-Jun-06 23:16
Venkat_Ivy29-Jun-06 23:16 
Questionhow to fix the minimum size of the window? Pin
mimimimilaw29-Jun-06 23:10
mimimimilaw29-Jun-06 23:10 
AnswerRe: how to fix the minimum size of the window? Pin
ovidiucucu29-Jun-06 23:50
ovidiucucu29-Jun-06 23:50 
GeneralRe: how to fix the minimum size of the window? Pin
mimimimilaw30-Jun-06 0:03
mimimimilaw30-Jun-06 0:03 
AnswerRe: how to fix the minimum size of the window? Pin
Viorel.29-Jun-06 23:51
Viorel.29-Jun-06 23:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.