To provide a LispWorks application with a DDE server, the following three steps should be followed: define a specialized server class using define-dde-server
, provide the server class with the functionality it requires by specializing methods on it and/or using define-dde-server-function
, and finally, start an instance of the server using start-dde-server
define-dde-server class-name service-name
The macro define-dde-server
defines a class for a Lisp DDE server. The class inherits from dde-server
.
define-dde-server-function name-and-options transaction (binding *)
form *
The macro define-dde-server-function
is used to define a server function, called name , which is called when a specific transaction occurs.
The defined function may either be attached to a server object (possibly only for a particular topic class) or to a dispatching topic object.
start-dde-server name
The function start-dde-server
creates an instance of a server of the class specified by name which then starts accepting transactions. If successful the function returns the server, otherwise nil
is returned.
The next command line shows how to use define-dde-server
to define a server class called foo-server
that has the service name " FOO
".
(win32:define-dde-server foo-server "FOO")
It is usual to provide the new server class with some functionality. The next command illustrates how to define a server function called test
, which takes a string as an argument, and prints this to the standard output. For convenience, the system topic is used, though usually it is better to define your own topic.
(win32:define-dde-server-function (bar :topic :system)
:execute
((x string))
(format t "~&~s~%" x)
t)
Finally, a foo-server
can be started using start-dde-server
(win32:start-dde-server `foo-server)
This function returns the server object, which responds to requests for conversations with the service name " FOO
", and accepts execute transactions for the function test
in the "System" topic.