Browse Source

* Patch from Antônio Galvão to make an event sink: Implements ConnectEvents and DisConnectEvents. (bug ID 28377)

git-svn-id: trunk@32822 -
michael 9 years ago
parent
commit
9111c9263e
1 changed files with 10 additions and 7 deletions
  1. 10 7
      packages/winunits-base/src/oleserver.pp

+ 10 - 7
packages/winunits-base/src/oleserver.pp

@@ -46,8 +46,9 @@ type
   TOleServer = class(TComponent, IUnknown)
   private
     FRemoteMachineName: string;
-    FEventDispatch: TServerEventDispatch;
     FServerData: PServerData;
+    FEventDispatch:     TServerEventDispatch;
+    FEventsConnection:  DWord;
   protected
     function QueryInterface(constref IID: TGUID; out Obj): HResult; stdcall; override;
     function _AddRef: Integer; stdcall;
@@ -157,14 +158,16 @@ implementation
       end;
 
 
-    procedure TOleServer.ConnectEvents(const Obj: IUnknown);
-      begin
-      end;
+procedure TOleServer.ConnectEvents(const Obj: IUnknown);
+begin
+  ComObj.InterfaceConnect(Obj, FServerData^.EventIID, FEventDispatch, FEventsConnection);
+end;
 
 
-    procedure TOleServer.DisconnectEvents(const Obj: Iunknown);
-      begin
-      end;
+procedure TOleServer.DisconnectEvents(const Obj: Iunknown);
+begin
+  ComObj.InterfaceDisconnect(Obj, FServerData^.EventIID, FEventsConnection);
+end;
 
 
     procedure TOleServer.InvokeEvent(DispID: TDispID; var Params: TVariantArray);