Products:

- SvCom
- Shell+
- PerfUtils

Download:

- SvCom
- Shell+
- PerfUtils

Ordering:

- Order now

Support:

- Contact directly


Embarcadero Technology Partner

 
    COM service connection  

Drop the TComObjectWithEvents instance on the client's form:

and set it's EventsHandlerHandleEventNotification property. This event handler is responsible for event processing. Note that the event's type was defined in the previous example's typelibrary.

Add the following code to the event handler:




procedure TComClientWithEventsForm.EventsHandlerHandleEventNotification(
  ASender: TObject;const EventMessage: WideString);
begin
     MEventsList.Lines.Add(FormatDateTime('HH:NN:SS', Now)+
  ' '+EventMessage);
end;

This code simply registers any incoming notification in the string list. The event time is added followed by the event text message.

Sure the link component must be connected to the server to receive events so add the following code to the form's OnCreate handler:




procedure TComClientWithEventsForm.FormCreate(Sender: TObject);
begin
     EventsHandler.Connect;
end;

We'll skip the security configuration for this example so add the following code to the unit:

 

initialization
    CoInitialize(nil);
    CoInitializeSecurity (nil, -1, nil, nil, 1, 1, nil, 0, nil);
finalization
    CoUninitialize;
end.

The last thing to be done is to fire an event:




procedure TComClientWithEventsForm.FormCreate(Sender: TObject);
begin
     EventsHandler.RaiseEvent('Some text');
end;

Now the example is ready for tests. Test it on the next step...

<< . index . 1 . 2 . 3 . >>
SvCom links:

- Overview
- Download
- Purchase
- FAQ
- Tutorial
- What's new
- For registered users
- Support

Copyright:

© 1998-2003. Alexey Dynnikov
© 2003-2016. ALDYN Software
© Design: Adonis i-cafe.