![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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(); CComQIPtrIMAPISession, &IID_IMAPISession spSession(pUnk); ULONG ulUIParam = (ULONG)(void*)m_hWnd; if(spSession) { CComPtrIAddrBook 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); } |
Ads |
#2
|
|||
|
|||
![]()
Have you tried getting the hWnd of the dialog and of the AddressBook dialog
and using SetWindowLong() to set the z-order of the forms? -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Tom" wrote in message ... 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(); CComQIPtrIMAPISession, &IID_IMAPISession spSession(pUnk); ULONG ulUIParam = (ULONG)(void*)m_hWnd; if(spSession) { CComPtrIAddrBook 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); } |
#3
|
|||
|
|||
![]()
Hi Ken,
Yes I have tried setting the z-order, hook procedures and a number of other experiments. I believe this may have something to do with Extended MAPI login. My theory is that when Outlook logs in the Outlook window handle is used in a way that screws up message processing. The real bazaar part of the issue is when I click on the address book window the Outlook Window momentarily gets focus and then reverts back to my dialog. I believe you are correct in your assumption that the z-order is messed up - however I think that there is a piece of the puzzle (along with hair) that I am missing. Thanks, Tom - "Ken Slovak - [MVP - Outlook]" wrote in message ... Have you tried getting the hWnd of the dialog and of the AddressBook dialog and using SetWindowLong() to set the z-order of the forms? -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Tom" wrote in message ... 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(); CComQIPtrIMAPISession, &IID_IMAPISession spSession(pUnk); ULONG ulUIParam = (ULONG)(void*)m_hWnd; if(spSession) { CComPtrIAddrBook 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); } |
#4
|
|||
|
|||
![]()
Since you're using Extended MAPI for opening the Address Book dialog maybe
it might be better if you posted about this in microsoft.public.win32.programmer.messaging. The Extended MAPI specialists hang out there so you're more likely to get an answer that you can use. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Tom" wrote in message ... Hi Ken, Yes I have tried setting the z-order, hook procedures and a number of other experiments. I believe this may have something to do with Extended MAPI login. My theory is that when Outlook logs in the Outlook window handle is used in a way that screws up message processing. The real bazaar part of the issue is when I click on the address book window the Outlook Window momentarily gets focus and then reverts back to my dialog. I believe you are correct in your assumption that the z-order is messed up - however I think that there is a piece of the puzzle (along with hair) that I am missing. Thanks, Tom - |
#5
|
|||
|
|||
![]()
How is your modal dialog that launches teh AB dialog displayed? Did tou make
the active Explorer or Inspector its parent? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Ken Slovak - [MVP - Outlook]" wrote in message ... Since you're using Extended MAPI for opening the Address Book dialog maybe it might be better if you posted about this in microsoft.public.win32.programmer.messaging. The Extended MAPI specialists hang out there so you're more likely to get an answer that you can use. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Tom" wrote in message ... Hi Ken, Yes I have tried setting the z-order, hook procedures and a number of other experiments. I believe this may have something to do with Extended MAPI login. My theory is that when Outlook logs in the Outlook window handle is used in a way that screws up message processing. The real bazaar part of the issue is when I click on the address book window the Outlook Window momentarily gets focus and then reverts back to my dialog. I believe you are correct in your assumption that the z-order is messed up - however I think that there is a piece of the puzzle (along with hair) that I am missing. Thanks, Tom - |
#6
|
|||
|
|||
![]()
Hi Dmityr,
I have tried using the Outlook window, and the active Explorer window as the parent- not to mention about every other window. We are opening our custom modeless dialog from a toolbar button command. Then from a button command I open the address book. "Dmitry Streblechenko" wrote in message ... How is your modal dialog that launches teh AB dialog displayed? Did tou make the active Explorer or Inspector its parent? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Ken Slovak - [MVP - Outlook]" wrote in message ... Since you're using Extended MAPI for opening the Address Book dialog maybe it might be better if you posted about this in microsoft.public.win32.programmer.messaging. The Extended MAPI specialists hang out there so you're more likely to get an answer that you can use. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Tom" wrote in message ... Hi Ken, Yes I have tried setting the z-order, hook procedures and a number of other experiments. I believe this may have something to do with Extended MAPI login. My theory is that when Outlook logs in the Outlook window handle is used in a way that screws up message processing. The real bazaar part of the issue is when I click on the address book window the Outlook Window momentarily gets focus and then reverts back to my dialog. I believe you are correct in your assumption that the z-order is messed up - however I think that there is a piece of the puzzle (along with hair) that I am missing. Thanks, Tom - |
#7
|
|||
|
|||
![]()
How do you retrieve the Outlook window handle and make it the parent of your
window? Whar if you pass to Address() the handle of the Outlook window? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Tom" wrote in message ... Hi Dmityr, I have tried using the Outlook window, and the active Explorer window as the parent- not to mention about every other window. We are opening our custom modeless dialog from a toolbar button command. Then from a button command I open the address book. "Dmitry Streblechenko" wrote in message ... How is your modal dialog that launches teh AB dialog displayed? Did tou make the active Explorer or Inspector its parent? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Ken Slovak - [MVP - Outlook]" wrote in message ... Since you're using Extended MAPI for opening the Address Book dialog maybe it might be better if you posted about this in microsoft.public.win32.programmer.messaging. The Extended MAPI specialists hang out there so you're more likely to get an answer that you can use. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Tom" wrote in message ... Hi Ken, Yes I have tried setting the z-order, hook procedures and a number of other experiments. I believe this may have something to do with Extended MAPI login. My theory is that when Outlook logs in the Outlook window handle is used in a way that screws up message processing. The real bazaar part of the issue is when I click on the address book window the Outlook Window momentarily gets focus and then reverts back to my dialog. I believe you are correct in your assumption that the z-order is messed up - however I think that there is a piece of the puzzle (along with hair) that I am missing. Thanks, Tom - |
#8
|
|||
|
|||
![]()
Hi Dmitry,
Well I found the problem. I did the old fashion method of commenting out code until you get the expected behavior. With our custom dialog we are creating a custom caption (titlebar) and handling some of the Non Client messages. As it turns out I was returning a FALSE (zero) for the WM_NCACTIVATE message which was screwing up the activation logic. Actually I had reviewed this code a few times and it never dawned on me that I was returning the improper value. Once I started returing TRUE all things started operating normal. BTW - I did check the Visual Studio message functionality and it does put a return value of FALSE for the default message. Thanks for your help. Tom - "Dmitry Streblechenko" wrote in message ... How do you retrieve the Outlook window handle and make it the parent of your window? Whar if you pass to Address() the handle of the Outlook window? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Tom" wrote in message ... Hi Dmityr, I have tried using the Outlook window, and the active Explorer window as the parent- not to mention about every other window. We are opening our custom modeless dialog from a toolbar button command. Then from a button command I open the address book. "Dmitry Streblechenko" wrote in message ... How is your modal dialog that launches teh AB dialog displayed? Did tou make the active Explorer or Inspector its parent? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Ken Slovak - [MVP - Outlook]" wrote in message ... Since you're using Extended MAPI for opening the Address Book dialog maybe it might be better if you posted about this in microsoft.public.win32.programmer.messaging. The Extended MAPI specialists hang out there so you're more likely to get an answer that you can use. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Tom" wrote in message ... Hi Ken, Yes I have tried setting the z-order, hook procedures and a number of other experiments. I believe this may have something to do with Extended MAPI login. My theory is that when Outlook logs in the Outlook window handle is used in a way that screws up message processing. The real bazaar part of the issue is when I click on the address book window the Outlook Window momentarily gets focus and then reverts back to my dialog. I believe you are correct in your assumption that the z-order is messed up - however I think that there is a piece of the puzzle (along with hair) that I am missing. Thanks, Tom - |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Offline address book synchronization issue | [email protected] | Outlook - General Queries | 0 | October 17th 07 11:30 PM |
Searching Global Address Book Issue, Wrong Letter is Displayed | Echoik | Outlook - Using Contacts | 0 | June 20th 07 10:53 PM |
OE Address Book Issue | Kuay Tim | Outlook Express | 4 | April 12th 07 05:00 AM |
Address book issue server migration | Redapples | Outlook - Installation | 2 | February 27th 07 03:16 PM |
Address Book Recovery/Installation Issue | Darren H | Outlook - Using Contacts | 11 | February 7th 07 01:09 PM |