Usage:
X is Server.Property
Server.Property := Value
R is Server.Method(Arg1, ... , Argn)
Server.Method(Arg1, ... , Argn)
Use the operator point in order to get and to set properties and to invoke methods.
The first argument of the point has to be object of type server. Use the function server to obtain such object. The second argument of the point has to be a property name or a method name followed by the arguments of the method.
The name of the property or of the method can be given as an atom or as a string.
For example, in order to call the method Method it does not matter whether you use
Server.'Method'() or Server."Method"() but anyway, we recommend to use atoms
because this will make your program more readable. Also, if the name of the method begins
with a small letter we can miss apostrophes. For example,
Server.'method'() and Server.method() are the same.
If you want to get property
this can be done by the operator point. You can
put in any expression Server.Property where Server is object of type server
and Property is the atom or the string which contains the name of one of the properties
of this server. You may look for the names of these properties in the Object Browser.
If you want to set property then it is easy again. Simply type this:
Server.Property := Value
Here Value has to be this value which you want to set to this
property. Here as you see := can be used to set property. Of course, this
operation is stable on backtracking.
If you want to invoke method then use Server.Method as function or as predicate. What to use (function or the predicate) depends on that do you need the return value of this method.
R is Server.Method(Arg1, ... , Argn)
Server.Method(Arg1, ... , Argn)
Here Server has to be object of type server and Method has to be the atom or the string which contains the name of one of the methods of this server. You can take this name from the Object Browser.
The arguments has to be from the types which this method needs. By default any type is VARIANT. If you want to use input/output argument (i.e. pointer to VARIANT) then put io functor in front of your variable argument (like this: io(X) ). The type VARIANT is standard for OLE and will be OK in the most cases but if you do not want to use it then you can specify another type explicitly (like this: int4(123) ). For such specification you can use one specifier from the following list:
int2
int4
float4
float8
str
dispatch_interface
You can combine any of this specifiers with io (like this: int4(io(X))
which mean that this argument is a pointer to four byte integer). The specifier
io
has to be closer to the variable than int4. If you change their
places then you will receive an error.
Example:
?-
S is server("Server.Name"),
S.'Property':=21,
write(S.'Property'),
nl, % writes 21
S.'Method'(A, io(B),
int2(C), float4(io(D)) ),
% A : VARIANT
% B : Pointer to VARIANT
% C : Two byte integer
% D : Pointer to four byte float
close(S).
See also:
OLE and ActiveX
Strawberry Prolog as OLE server
server, close
embed_server
raise_event
Examples:
Word.spj
OLE.spj
OLE