Usage:
Server is server(ServerName)
Server is server2(ServerName, Events_func, ConnectionPoint)
Opens an OLE server and returns in Server an object of type server which is associated with it. If you want to listen for the events which will come from this server provide Events_func which will proceed these events. If you want to filter the stream of all incoming events you can provide the name of the connection point whose events you want to be proceeded.
ServerName | Server Name (such as "Strawberry.Server.1") or Server Class ID (such as "{ECD21404-C8F2-4202-BDFD-DBCBC7A5063C}") |
Events_func | The name of the class which will proceed the events from the server. Use _ or the function server if you do not want to listen for events. |
ConnectionPoint | The name of the connection point whose events you want to receive. Use _ if you want to receive the events from all connection points. |
If you use _ for ConnectionPoint you can use the global variable G_Connection_Point to take the name of the connection point which is sending the event. If the server has more than one connection point it is better to listen for only one of them because most events are sent to all connection points and if you listen to all of them these events will be duplicated. The servers which have more than one connection point usually have a new and old interface supported in the new and in the old connection point.
When you process events you have to bear in mind that your program will receive the names of
the events as atoms. When you call method then you can use atom or string for its name
but for events you can use only atoms. For example, in order to call the method Method
it will be the same if you use Server.'Method'() or Server."Method"()
but if you wait for the event Event then you have to use Events_func::'Event'
instead of Events_func::"Event".
Example:
?-
Server is server2("Strawberry.Server.1", on_event, "_IStrawberrySvrEvents"),
wait(10),
close(Server).
on_event::Event( | Arguments):-
write(G_Connection_Point), nl,
write(Event( | Arguments)), nl.
See also:
OLE and ActiveX
Strawberry Prolog as OLE server
close
. (point)
embed_server
raise_event
Examples:
Merlin.spj
Media Player.spj
IE.spj
OLE
OLE / Servers