Outlook 2000 Add-in's and Delphi5

Outlook 2000 Add-in's and Delphi5

Post by Ed Hillman » Wed, 23 Jul 2003 07:27:01



Hi folks. I'm trying to write an Add-in for Outlook 2000. I've been able to import the type library and hook into the ApplicationEvents. But I want to try and add a new Property Pages to the Options dialog. So I've hooked into the OptionsPagesAdd method. But whenever I do anything with the provided PropertyPages variable, I get an access violation.

Has anyone been able to access this, and if there's any trick that has do be done? I think I've done all the obvious stuff.

Thanks,
Ed
 
 
 

Outlook 2000 Add-in's and Delphi5

Post by Dmitry Str » Wed, 23 Jul 2003 07:43:56

See Babelfish sample COM addin source code on my site.

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




to import the type library and hook into the ApplicationEvents. But I want
to try and add a new Property Pages to the Options dialog. So I've hooked
into the OptionsPagesAdd method. But whenever I do anything with the
provided PropertyPages variable, I get an access violation.
be done? I think I've done all the obvious stuff.

 
 
 

Outlook 2000 Add-in's and Delphi5

Post by Ed Hillman » Wed, 23 Jul 2003 09:49:56


Hi Dmitry. I've looked at your example. But when I try to set up my TOutlookApplication instance as you have, I get a compiler error... Specifically, it's this part...

procedure TBabelFish.OnConnection(const Application: IDispatch;
ConnectMode: ext_ConnectMode; const AddInInst: IDispatch;
var custom: PSafeArray);
var i : integer;
begin
FApplication:=Application;
FOutlookApplication:=TOutlookApplication.Create(Application);
FOutlookApplication.OnOptionsPagesAdd:=OnOptionsPagesAdd;
FInspectors:=TOutlookInspectors.Create(FApplication.Inspectors);
FInspectors.OnNewInspector:=OnNewInspector;
for i:=1 to FApplication.Inspectors.Count do begin
OnNewInspector(FInspectors, IDispatch(FApplication.Inspectors.Item(i)) as _Inspector);
end;
FExplorers:=TOutlookExplorers.Create(FApplication.Explorers);
FExplorers.OnNewExplorer:=OnNewExplorer;
for i:=1 to FApplication.Explorers.Count do begin
OnNewExplorer(FExplorers, IDispatch(FApplication.Explorers.Item(i)) as _Explorer);
end;
end;


My compiler complains about passing in an IDispatch to the TOutlookApplication.Create() method, which is expecting a TComponent.

Can I zip up my project and send it to you, if you have the time or the inclincation to take a look at it?

Ed
 
 
 

Outlook 2000 Add-in's and Delphi5

Post by Dmitry Str » Thu, 24 Jul 2003 13:27:38

I can't think of any tricks. If you completely replace your implementation
of TOutlookApplication with the one in uOutlookEvents.pas, do you still get
the error?

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




the class of the same name that was automatically generated by Delphi ...
were effectively doing the same thing). I updated my code to use your unit,
etc. But I was still getting the access violation.
TOutlookApplication.InvokeEvent method (I added a MessageDlg call at the
very start, and I get the access violation before it).
example, I receive the OnNewMail event without an error. It's like
something is going wrong in the internals in accessing the PropertyPages
object being passed through.

clause
;
 
 
 

Outlook 2000 Add-in's and Delphi5

Post by Dmitry Str » Fri, 25 Jul 2003 15:08:20

No, any version of Outlook 2000 and up should work the same when it comes to
the prop pages.
Can you give a bit more details about what happens and when?

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




called, but I don't know why. As I said, really odd.
it's set up that way, but do you need a specific release of Outlook 2000 to
be able to access PropertyPages? It's a bit of a reach, I know, but I'm
grabbing at straws here. :)

implementation
get
 
 
 

Outlook 2000 Add-in's and Delphi5

Post by Ed Hillman » Tue, 29 Jul 2003 12:12:18


I've found my problem.

I had an old copy of my plug registered on my machine. So, when I was re-registering my new one, the old ClassId was persisting. Cleaned up my registry and started with the new on, and I'm good.

Thanks for the sanity check, though. You helped narrow down my problems to my code. :)

Thanks again!
Ed