A
Andrew Lockwood
Apologies for posting a question about Delphi, but I cannot find an active
Delphi forum for this type of issue.
Can anyone explain to me / show me some sample code for trapping the events
of an RDOMail item, for example. I have tried creating a wrapper as follows
TRDOMailItem = class(TOleServer)
private
FIntf : IRDOMail;
FOnModified : TNotifyEvent;
FOnDeleted : TNotifyEvent;
FOnMoved : TNotifyEvent;
FOnClose : TNotifyEvent;
function GetDefaultInterface: IRDOMail;
//FOnMovedEx : (const OldParentEntryId: WideString; const
NewParentEntryID: WideString); dispid 5;
protected
procedure Connect;
procedure ConnectTo(svrIntf : IRDOMail);
procedure Disconnect; override;
procedure InitServerData; override;
procedure InvokeEvent(DispID: TDispID; var Params: TVariantArray);
override;
public
//need to add more events
property OnModified : TNotifyEvent read FOnModified write FOnModified;
property OnDeleted : TNotifyEvent read FOnDeleted write FOnDeleted;
property OnMoved : TNotifyEvent read FOnMoved write FOnMoved;
property OnClose : TNotifyEvent read FOnClose write FOnClose;
end;
procedure TRDOMailItem.InitServerData;
const
CServerData: TServerData = (
ClassID: '{02ABB20A-FB8A-4433-8D66-135C6CCD0F32}'; //Class_xxx
IntfIID: '{D85047E0-7767-4D48-86B6-28BDB5728ABB}'; //IID_xxx
EventIID: '{0D00E38E-315D-49D5-9331-80BC1559C0E7}'; //DIID_xxx
LicenseKey: nil;
Version: 500);
begin
ServerData := @CServerData;
end;
procedure TRDOOutlookServer.Connect;
var punk: IUnknown;
begin
if FIntf = nil then
begin
punk := GetServer;
ConnectEvents(punk);
Fintf:= punk;
end;
end;
but it doesn't work - it complies and runs OK, but the InvokeEvent procedure
is never executed, so I cannot capture the events.
Delphi forum for this type of issue.
Can anyone explain to me / show me some sample code for trapping the events
of an RDOMail item, for example. I have tried creating a wrapper as follows
TRDOMailItem = class(TOleServer)
private
FIntf : IRDOMail;
FOnModified : TNotifyEvent;
FOnDeleted : TNotifyEvent;
FOnMoved : TNotifyEvent;
FOnClose : TNotifyEvent;
function GetDefaultInterface: IRDOMail;
//FOnMovedEx : (const OldParentEntryId: WideString; const
NewParentEntryID: WideString); dispid 5;
protected
procedure Connect;
procedure ConnectTo(svrIntf : IRDOMail);
procedure Disconnect; override;
procedure InitServerData; override;
procedure InvokeEvent(DispID: TDispID; var Params: TVariantArray);
override;
public
//need to add more events
property OnModified : TNotifyEvent read FOnModified write FOnModified;
property OnDeleted : TNotifyEvent read FOnDeleted write FOnDeleted;
property OnMoved : TNotifyEvent read FOnMoved write FOnMoved;
property OnClose : TNotifyEvent read FOnClose write FOnClose;
end;
procedure TRDOMailItem.InitServerData;
const
CServerData: TServerData = (
ClassID: '{02ABB20A-FB8A-4433-8D66-135C6CCD0F32}'; //Class_xxx
IntfIID: '{D85047E0-7767-4D48-86B6-28BDB5728ABB}'; //IID_xxx
EventIID: '{0D00E38E-315D-49D5-9331-80BC1559C0E7}'; //DIID_xxx
LicenseKey: nil;
Version: 500);
begin
ServerData := @CServerData;
end;
procedure TRDOOutlookServer.Connect;
var punk: IUnknown;
begin
if FIntf = nil then
begin
punk := GetServer;
ConnectEvents(punk);
Fintf:= punk;
end;
end;
but it doesn't work - it complies and runs OK, but the InvokeEvent procedure
is never executed, so I cannot capture the events.