Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / February 2006

Tip: Looking for answers? Try searching our database.

Outlook add-in, MS Word problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dennis Masko - 21 Feb 2006 14:31 GMT
Hello,

I'm implementing Outlook COM add-in for MS Office 2003 SP2 with VC++
6.0.

A part of the functionality does the following: in NewInspector event
of Inspectors collection obtained COM interface "insp" is used to
get mail item edited by newly created inspector. In example I use mail
item to set TO field. When in outlook Tools\Options\Mail Format\Use
Microsoft Office Word is NOT checked everything works ok. But when I
check this option and use MS Word as e-mail editor the sample code does
not work correctly. All assignment to "TO" field are reflected in
very first opened Word editor. It happened because "insp" parameter
points to the same object in all cases when OnNewInspector event was
fired (previously opened MS Word editors were not closed).

void __stdcall CCarbonOutClient::OnNewInspector(Outlook::_Inspector*
insp)
{

           ...

           IDispatch* pCurrentItem;
           CComPtr<Outlook::_MailItem> pMailItem;

           insp->get_CurrentItem(&pCurrentItem);
           HRESULT hr = pCurrentItem->QueryInterface(IID__MailItem,
(void**)&pMailItem);
           ...
         pMailItem->TO = "Some Text";
}

How I can overcome this problem?
Is there any hot fix from Microsoft or some workaround?

Thanks,
Dennis.
Jim - 21 Feb 2006 17:42 GMT
What you may have to do Dennis is use an Inspector Wrapper to help with
your problem. Earlier Ken pointed me to an example in C#:
http://www.outlookcode.com/codedetail.aspx?id=797
Hope this helps

> Hello,
>
[quoted text clipped - 33 lines]
> Thanks,
> Dennis.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.