T
Tom
Hello,
I have an Outlook Add-in that creates a custom dialog, and within that
dialog we try to open the Address Book Dialog. The problem is that within
the custom Dialog the address dialog does not gain focus. If I open the
Address Book dialog within Outlook from a button click - lets say from a
Add-in toolbar - the Address Book dialog works fine. However if I try to
open it up from a dialog the Address Book does not gain focus. This happens
whether we create modeless or modal dialogs. The code below works from a
button click on the add-in toolbar, but will not work if I create a dialog
and then try to open the address book from the custom dialog. Does anybody
know of any work around.
Thanks,
Tom -
IUnknownPtr pUnk = spNameSpace->GetMAPIOBJECT();
CComQIPtr<IMAPISession, &IID_IMAPISession> spSession(pUnk);
ULONG ulUIParam = (ULONG)(void*)m_hWnd;
if(spSession)
{
CComPtr<IAddrBook> spAddrBook;
HRESULT h = spSession->OpenAddressBook(ulUIParam, NULL, 0, &spAddrBook);
if(SUCCEEDED(h) && spAddrBook)
{
LPADRLIST lpAddrList = NULL;
LPSTR rglpszDestTitles[1];
ULONG rgulDestComps[1];
ULONG ulFlags = DIALOG_MODAL | AB_RESOLVE;
rglpszDestTitles[0] = "To";
rgulDestComps[0] = MAPI_TO;
ADRPARM adrparm;
adrparm.cbABContEntryID = 0;
adrparm.lpABContEntryID = NULL;
adrparm.ulFlags = ulFlags;
adrparm.lpReserved = NULL;
adrparm.ulHelpContext = 0;
adrparm.lpszHelpFileName = NULL;
adrparm.lpfnABSDI = NULL;
adrparm.lpfnDismiss = NULL;
adrparm.lpvDismissContext = NULL;
adrparm.lpszCaption = "Select Recipients";
adrparm.lpszNewEntryTitle = "For this test dialog";
adrparm.lpszDestWellsTitle = "Selected Recipients:";
adrparm.cDestFields = 1;
adrparm.nDestFieldFocus = 0;
adrparm.lppszDestTitles = rglpszDestTitles;
adrparm.lpulDestComps = rgulDestComps;
adrparm.lpContRestriction = NULL;
adrparm.lpHierRestriction = NULL;
spAddrBook->Address((ULONG*)&ulUIParam, (LPADRPARM)&adrparm,
&lpAddrList);
}
I have an Outlook Add-in that creates a custom dialog, and within that
dialog we try to open the Address Book Dialog. The problem is that within
the custom Dialog the address dialog does not gain focus. If I open the
Address Book dialog within Outlook from a button click - lets say from a
Add-in toolbar - the Address Book dialog works fine. However if I try to
open it up from a dialog the Address Book does not gain focus. This happens
whether we create modeless or modal dialogs. The code below works from a
button click on the add-in toolbar, but will not work if I create a dialog
and then try to open the address book from the custom dialog. Does anybody
know of any work around.
Thanks,
Tom -
IUnknownPtr pUnk = spNameSpace->GetMAPIOBJECT();
CComQIPtr<IMAPISession, &IID_IMAPISession> spSession(pUnk);
ULONG ulUIParam = (ULONG)(void*)m_hWnd;
if(spSession)
{
CComPtr<IAddrBook> spAddrBook;
HRESULT h = spSession->OpenAddressBook(ulUIParam, NULL, 0, &spAddrBook);
if(SUCCEEDED(h) && spAddrBook)
{
LPADRLIST lpAddrList = NULL;
LPSTR rglpszDestTitles[1];
ULONG rgulDestComps[1];
ULONG ulFlags = DIALOG_MODAL | AB_RESOLVE;
rglpszDestTitles[0] = "To";
rgulDestComps[0] = MAPI_TO;
ADRPARM adrparm;
adrparm.cbABContEntryID = 0;
adrparm.lpABContEntryID = NULL;
adrparm.ulFlags = ulFlags;
adrparm.lpReserved = NULL;
adrparm.ulHelpContext = 0;
adrparm.lpszHelpFileName = NULL;
adrparm.lpfnABSDI = NULL;
adrparm.lpfnDismiss = NULL;
adrparm.lpvDismissContext = NULL;
adrparm.lpszCaption = "Select Recipients";
adrparm.lpszNewEntryTitle = "For this test dialog";
adrparm.lpszDestWellsTitle = "Selected Recipients:";
adrparm.cDestFields = 1;
adrparm.nDestFieldFocus = 0;
adrparm.lppszDestTitles = rglpszDestTitles;
adrparm.lpulDestComps = rgulDestComps;
adrparm.lpContRestriction = NULL;
adrparm.lpHierRestriction = NULL;
spAddrBook->Address((ULONG*)&ulUIParam, (LPADRPARM)&adrparm,
&lpAddrList);
}