D
Dennis Masko
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.
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.