Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Add-ins for Outlook (http://www.outlookbanter.com/add-ins-outlook/)
-   -   Sending from Word with Outlook COM Addin (http://www.outlookbanter.com/add-ins-outlook/16254-sending-word-outlook-com-addin.html)

james May 30th 06 02:44 PM

Sending from Word with Outlook COM Addin
 
I have an ATL/C++ COM Addin that processes the message on the
Application::OnSend Event.

It works without problem using Office2003, in all the different ways a
mail can be sent from the desktop. (Outlook, Word, etc,
Shell|SendTo|Mail Recipient)

It works _most_ of the time using Office XP. The following two
scenarios fail.
1/ Using OfficeXP SP3, with Outlook not active.
Start a word doc, select FIle | Send To | Mail Recepient (As
Attachment) ; enter the recipient details, and hit send.
The addin activates, BUT, the message isn't sent , and the
inspector remains open.
The inspector window can be closed manually.

2/ Using OfficeXP SP3, with Outlook not active.
Right click on, say, a doc on the desktop. Select Send To | Mail
Recipient, enter recipient details and hit send.
The addin activates, BUT, the message isn't sent, and the inspector
remains open.
If the inspector is closed manually, the windows explorer crashes,
....

The code causing problems seems to be the second last line below (note
- error handling code and other functionality removed):
CComPtrOutlook::_Application spApplication;
....
CComPtrOutlook::_NameSpace spSession;
spApplication-get_Session(&spSession);

IUnknown* pUnk = NULL;

spSession-get_MAPIOBJECT(&pUnk);
...
pUnk-Release();

Commenting out the last two lines makes the code that is there work
correctly. (Further functions that need to use the pUnk pointer are
also disabled)

(I need the LPMAPISESSION pointer to access the Primary User's SMTP
address, and don't want any security prompts.)



All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com