Ralf Garbe
Posts: 20
Joined: 2014-11-22
|
Hello,
when running the following code on Outlook 2010, Outlook crashes.
when debugging it with the SHOWMESSAGE('0') line, all works well.
Could you help me on what I do wrong and how it could be improved.
Thanks,
Ralf
_______________________________
procedure TAddInModule.adxOutlookAppEvents1InspectorActivate(Sender: TObject);
var
IDsp: IDispatch;
Mail: MailItem;
begin
//showMessage('0');
try
IDsp := OutlookApp.ActiveInspector.CurrentItem;
except
end;
if Assigned(IDsp) then
try
IDsp.QueryInterface(IID__MailItem, Mail);
if Assigned(Mail) then begin
mail.Subject := 'setting the subject';
end;
finally
IDsp := nil;
end;
end; |
|
Andrei Smolin
Add-in Express team
Posts: 18823
Joined: 2006-05-11
|
Hello Ralf,
Add-in Express passes an Outlook2000.TInspector to this event procedure. You can use this fact to retrive the inspector being activated. Currently, you retrieve the active inspector; it looks like Outlook may fire the Activate event on an inspector first and set that inspector as active then.
Andrei Smolin
Add-in Express Team Leader |
|