A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook add-in, MS Word problem



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 21st 06, 03:31 PM posted to microsoft.public.outlook.program_addins
Dennis Masko
external usenet poster
 
Posts: 1
Default Outlook add-in, MS Word problem

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::_Inspect or*
insp)
{

...

IDispatch* pCurrentItem;
CComPtrOutlook::_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.

  #2  
Old February 21st 06, 06:42 PM posted to microsoft.public.outlook.program_addins
jim
external usenet poster
 
Posts: 26
Default Outlook add-in, MS Word problem

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

Dennis Masko wrote:
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::_Inspect or*
insp)
{

...

IDispatch* pCurrentItem;
CComPtrOutlook::_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.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Printing Customized Outlook Form using Word Template ajkim001 Outlook - Using Forms 15 April 28th 06 06:28 PM
can you add addresses in word documents automatically to outlo Sue Manning-Jones Outlook - Using Contacts 5 March 9th 06 10:19 PM
outlook to word calendar add in Alan Smithee Jr. Outlook - General Queries 6 February 11th 06 11:41 PM
Word is opening when I open Outlook Mike McNicholas Outlook - Installation 4 January 30th 06 04:23 AM
Outlook with Word error smags Outlook - General Queries 2 January 22nd 06 08:32 PM


All times are GMT +1. The time now is 08:42 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-2025 Outlook Banter.
The comments are property of their posters.