EventServer

Declaration

[id(0x00000059), propget]
HRESULT EventServer([out, retval] IDispatch** Value);

Description

This method exposes internal event server  interface. Currently this server is used to fire OnDeviceButton event to be implemented via IConnectionPoints interface functionality.

This functionality enables to dynamically connect event handlers for OnDeviceButtonEvent at runtime

Here is a Delphi sample code showing how to connect/disconnect the SomeObject.OnDeviceButton handler.

var  FSigDevServerWrapper: TEventServer;
procedure ConnectToDeviceServer(
  const EventServer: IUnknown);
begin
    if not Assigned(FSigDevServerWrapper) then
        FSigDevServerWrapper := TEventServer.Create(nil);
    FSigDevServerWrapper.Disconnect;
    with FSigDevServerWrapper do
    begin
        AutoConnect := false;
        ConnectTo(EventServer as IEventServer);
        OnDeviceButton := SomeObject.OnDeviceButton;
    end;
end;

procedure DisconnectFromDeviceServer;
begin
    if Assigned(FSigDevServerWrapper) then
        FSigDevServerWrapper.Disconnect;
end;


There is, however, a much simpler approach to use just

var SignatureDevice : TStepoverSignatureDevice;

SignatureDevice.OnDeviceButton := SomeObject.OnDeviceButton