Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Outlook
Hello community!
 
I have a dll to connect to the address book of Outlook. The dll works fine on Outlook 2003, 2007 but not on Outlook 2010.
 
When I want to close the main exe programm the Visual Studio returns a failure and the debugger jumps to following position:
 
dbghook.c
 
void __cdecl _CRT_DEBUGGER_HOOK(int _Reserved)
{
    /* assign 0 to _debugger_hook_dummy so that the function is not folded in retail */
    (_Reserved);
    _debugger_hook_dummy = 0;
}
 
This is my function to test the connection to Outlook:
 
BOOL ConnectOutlook(LPTSTR lpstrProfileName, LPTSTR lpstrProfilePwd)
{
	BOOL bReturn = FALSE;
	HRESULT hRes = NULL;
	LPMAPISESSION lpSession = NULL;
	LPADRBOOK lpAdrBook = NULL;
	ULONG ulObjType = 0;
	LPABCONT lpABContainer = NULL;
	LPMAPITABLE lpTableRoot = NULL;
 
	hRes = MAPIInitialize(NULL);
	if(hRes != S_OK)
	{
		goto cleanup;
	}
 
	hRes = MAPILogonEx(NULL, lpstrProfileName, lpstrProfilePwd, MAPI_EXTENDED | MAPI_NEW_SESSION |
		MAPI_EXPLICIT_PROFILE | MAPI_UNICODE | MAPI_MULTITHREAD_NOTIFICATIONS, &lpSession);
	if(hRes != S_OK)
	{
		goto cleanup;
	}
 
	hRes = lpSession->OpenAddressBook(0, NULL, 0, &lpAdrBook);
	if(hRes != S_OK)
	{
		goto cleanup;
	}
 
	hRes = lpAdrBook->OpenEntry(0, NULL, NULL, 0, &ulObjType, (LPUNKNOWN*)&lpABContainer);
	if(hRes != S_OK)
	{
		goto cleanup;
	}
 
	hRes = lpABContainer->GetHierarchyTable(MAPI_UNICODE, &lpTableRoot);
	if(hRes != S_OK)
	{
		goto cleanup;
	}
 
	bReturn = TRUE;
 
cleanup:
	if(lpTableRoot)
	{
		lpTableRoot->Release();
	}
 
	if(lpABContainer)
	{
		lpABContainer->Release();
	}
 
	if(lpAdrBook)
	{
		lpAdrBook->Release();
	}
 
	if(lpSession)
	{
		lpSession->Logoff(NULL, NULL, NULL);
		lpSession->Release();
	}
 
	MAPIUninitialize();
 
	return bReturn;
}
 
Can someone help me, please?
Posted 3-Jul-11 1:10am
arstom272
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Now I have a solution for my problem.
 
I use the function GetCurrentDirectory(...) to save my log files. When I use the MAPIInitialize(...) and MAPILogoEx(...) functions then the current directory is changed to the installation path of office package. As I work on a Windows 7 machine I have no access to the folder programm files where the office package is installed. This means that I have no rights to save my log files and I get an exception.
 
As a result I save the path to the current directory when the program starts and so I have no problems anymore. Smile | :)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Look at the call stack and see if there's an actual line in your code that's causing this. The code you posted from dbghook.c is a generic error stop, but something in your code (or the DLL) triggered it.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 520
1 Maciej Los 290
2 Richard MacCutchan 265
3 BillWoodruff 265
4 Suraj Sahoo | Coding Passion 155
0 OriginalGriff 8,764
1 Sergey Alexandrovich Kryukov 7,437
2 DamithSL 5,639
3 Maciej Los 5,279
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web03 | 2.8.1411028.1 | Last Updated 5 Jul 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100