Outlook 97 & ActiveExplorer

J

Julieta Prandi

Hi,
I'm trying to make work a addin in Outlook 97 but it seems complex :(
I've implemented in the exchange way and the Install function is called.
In EECONTEXT_VIEWER I'm trying to get the ActiveExplorer but it throws a
exception if I use Office 2k type libraries or it returns NULL if I use
Office 97 typelibraries.
This addin works fine in Office 2k.

I include the typelibrary in this way (I copied from another mail sent here
from a MVP):
// Define this according to the OL version you are compiling under
#define OUTL8 // #define OUTL8 or OUTL85 or OUTL9
#if defined(OUTL9) // Outlook 2000
#import "C:\Program Files\Microsoft Office\Office\mso9.dll" //IMPPROPS
#import "C:\Program Files\Microsoft Office\Office\msoutl9.olb" //IMPPROPS
#elif defined(OUTL85) // Outlook 98
#import "C:\Program Files\Microsoft Office\Office\mso97.dll" IMPPROPS
#import "C:\Program Files\Microsoft Office\Office\msoutl85.olb" IMPPROPS
#elif defined(OUTL8) // Outlook 97
#import "stdole2.tlb" IMPPROPS include("IPicture") \
exclude("Font", "IUnknown", "IDispatch", "IEnumVARIANT", "IFont")
#import "fm20.dll" IMPPROPS include("IFont") \
exclude("OLE_COLOR", "OLE_HANDLE") rename("Pages", "FMPages")
#pragma warning(disable: 4146)
#import "c:\Program Files\Microsoft Office\Office\mso97.dll" Office \
rename("DocumentProperties", "DocProps")
#pragma warning(default: 4146)
#import "c:\Program Files\Microsoft Office\Office\msoutl8.olb" Outlook \
rename("_IMailItem", "_MailItem")
#endif


The code that doesn't work is:
....

case EECONTEXT_VIEWER:
GetOutlookApp(lpExchangeCallback, m_olAppPtr); // this line works
fine (in the same it works in 2k)
Outlook::_IExplorerPtr spExplorer = m_olAppPtr->ActiveExplorer();

the spExplorer always return NULL or a exception is thrown using 2k
libraries.

Please help me!

Thank you!
<-- Julieta -->
 
D

Dmitry Streblechenko

Did you try to use late binding (GetIdsOfNames/Invoke) to retrieve
Application.ActiveExplorer?
What do you need the explorer for? Note that if you create buttons in
Outlook 97, you won't be able to sink the click events; believe it or not,
Office 97 toolbars/buttons do not expose any events.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
J

Julieta Prandi

Hi Dmitry,
Thank you a lot for your help!

I didn't try that. Can you send me a sample code or link?
I know that I won't be able to handle the clicks but I'll manage to do it in
some way -> I hope so :)

Thanks,
<-- Julieta -->
 
J

Julieta Prandi

Hi,
I tried using:

HRESULT hRes = m_OLAppPtr->QueryInterface(IID_IDispatch, (void **)
&lpMyDispatch);
hRes = lpMyDispatch->GetIDsOfNames(IID_NULL, &szApplication, 1,
LOCALE_SYSTEM_DEFAULT, &dspid);
hRes = lpMyDispatch->Invoke(dspid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD, &dispparamsNoArgs, &vtResult, NULL, NULL);
lpMyDispatch->Release();

and vtResult returns NULL and hRes return NO_ERROR in all the calls.

I tried using VB and the ActiveExplorer works fine so it looks as a problem
in C++.

Please help me!
<-- Julieta -->
 
J

Julieta Prandi

I've found the problem.
The late binding wasn't necessary, the problem was the context.
If I run the same code in another EECONTEXT_VIEWER (e.g.: when opening a
property dialog) the same code works.

Julieta
 
M

Michael Tissington

I have seen this before .... to make matters worse in Outlook 2002 and 2003
I have been able to get back an Inspector object at different times but it
has not been usable (I guess because Outlook has not finished initializing
it)
 
D

Dmitry Streblechenko

Why do you need EECONTEXT_VIEWER at all? If you are planning to use OOM, go
all the way and use Application.Inspectors.NewInspector event instead.
If I remember correctly, you can't insert your toolbars/buttons in the
NewInspector event handler (the inspector is not yet initialized), you will
need to wait for the every first Inspector.Active event to fire.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
S

Sue Mosher [MVP-Outlook]

Outlook 97 doesn't fire OOM events, does it?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
D

Dmitry Streblechenko

You are right (just checked an Outlook 97 VMWare session) - events were
added to Outlook 98.
Outlook 97 does not even have the Application.Explorers and Inspectors
collections.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

Outlook 97 doesn't fire OOM events, does it?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top