next up previous
Next: DDE server mode Up: Windows DDE interface Previous: Windows DDE interface

DDE client interface

The DDE client interface allows Prolog to talk to DDE server programs. We will demonstrate the use of the DDE interface using the Windows PROGMAN (Program Manager) application:

1 ?- open_dde_conversation(progman, progman, C).

C = 0
2 ?- dde_request(0, groups, X)

--> Unifies X with description of groups

3 ?- dde_execute(0, '[CreateGroup("DDE Demo")]').

Yes

4 ?- close_dde_conversation(0).

Yes

For details on interacting with PROGMAN, use the SDK online manual section on the Shell DDE interface. See also the Prolog library progman.pl, which may be used to write simple Windows setup scripts in Prolog.

open_dde_conversation( +Service, +Topic, -Handle)

  Open a conversation with a server supporting the given service name and topic (atoms). If successful, Handle may be used to send transactions to the server. If no willing server is found this predicate fails silently.
close_dde_conversation( +Handle)

  Close the conversation associated with Handle. All opened conversations should be closed when they're no longer needed, although the system will close any that remain open on process termination.
dde_request( +Handle, +Item, -Value)

  Request a value from the server. Item is an atom that identifies the requested data, and Value will be an atom ( CF_TEXT data in DDE parlance) representing that data, if the request is successful. If unsuccessful, Value will be unified with a term of form error(reason), identifying the problem. It could be argued that the atoms above should be strings.
dde_execute( +Handle, +Command)

  Request the DDE server to execute the given command-string. Succeeds if the command could be executed and fails with error message otherwise.



Passani Luca
Tue Nov 14 08:58:33 MET 1995