It's Work.
Thank you so much ,everbody.
Now ,
I found that Lazarus provide TEvenkSink .
but It differs from delphi in some Method.
That Object can Detect DisIDs
like this
...
type
...
{ TForm1 }
TForm1 = class(TForm)
..
ListBox1 : TListBox;
...
private
{ private declarations }
...
MsOfficeApp : Variant; //OLEVariant;
F_SinkEvent : TEvent_TestSink;//TEventSink;
...
...
procedure _GetEventMsOffice(Sender: TObject; DispID: Integer;
const IID: TGUID; LocaleID: Integer; Flags: Word;
Params: tagDISPPARAMS; VarResult, ExcepInfo, ArgErr: Pointer);
...
public
{ public declarations }
end;
var
Form1: TForm1;
{ TForm1 }
procedure TForm1._GetEventMsOffice(Sender: TObject; DispID: Integer;
const IID: TGUID; LocaleID: Integer; Flags: Word;
Params: TDispParams; VarResult, ExcepInfo, ArgErr: Pointer);
begin
//Collect DISP-Event
ListBox1.Items.add('DISPID = '+ IntToStr(DispID));
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
MsOfficeApp := UnAssigned;
...
//Open MsOffice
try
MsOfficeApp := CreateOleObject('PowerPoint.Application');
...
F_SinkEvent := TEvent_TestSink.Create(Form1);
F_SinkEvent.OnInvoke := @(Form1._GetEventMsOffice);
F_SinkEvent.Connect(MsOfficeApp,IID_MSApplication);
...
except
ShowMessage('Error...');
Exit;
end;
...
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
if Assigned(F_SinkEvent) then F_SinkEvent.Destroy;
MsOfficeApp.Quit;
MsOfficeApp := UnAssigned;
end;
...