OneSpace Modeling FAQ: DDE
How do I talk to OneSpace Modeling via DDE?
OneSpace Modeling services DDE requests, and you can also send DDE requests from OneSpace Modeling
via Integration Kit functionality. See the section "DDE Interface" in
the Integration Kit documentation for details.
DDE is a fairly old interprocess communication protocol. It is still
used both in Windows applications and in the operating system, though.
As an example, the
Windows shell uses DDE
to notify running applications when a user double-clicks a file which is associated
with the application.
DDE uses messages which are sent to an application's message queue. The
DDE protocol requires all DDE-enabled applications to continually process
messages, or else DDE communication in the system will be blocked. While
an DDE-enabled application is busy doing other things (parsing a file,
processing a spreadsheet, or, in OneSpace Modeling's case, blending complex edges),
it may not react to DDE messages for a while, and as a consequence,
even DDE conversations with
other apps may block for some time.
For this reason, use DDE sparingly, and only in circumstances where
losing a message at least does not have catastrophic effects. That said,
here is a simple example in VBA which shows how to open a conversation
with OneSpace Modeling and have it execute a command.
Sub dde()
Dim nChannelNumber As Variant
nChannelNumber = DDEInitiate("PESD", "GENERAL")
DDEExecute nChannelNumber, "(CREATE_PART :name ""dde_test_part"" :owner ""/"")"
DDETerminate nChannelNumber
End Sub
By the way, if you want to try out DDE communication from a shell window,
check out the command-line tool
ddeclient.exe
which is
part of the Emacs distribution:
$ echo '(CREATE_PART :name "dde_test_part" :owner "/")' | ddeclient PESD GENERAL
--
ClausBrod - 14 Jul 2005
How do I talk to other applications from OneSpace Modeling via DDE?
The Integration Kit provides the following DDE functionality to talk to
external applications which support DDE:
-
sd-dde-initiate
-
sd-dde-execute
-
sd-dde-poke
-
sd-dde-request
-
sd-dde-close
-
sd-dde-request-timeout
-
sd-dde-execute-timeout
The exact commands to be sent via DDE differ from application to application.
The
DDE FAQ provides
information on many such applications and is a good starting point for further
search.
A typical DDE session usually involves three steps:
- Initialization
- Communication phase
- Teardown
In phase 1, you contact the external application using
sd-dde-initiate
:
(setf dde (oli:sd-dde-initiate "EXCEL" "System")) ;; connect to Excel
In phase 2, you send commands using
sd-dde-execute
and inquire data from
the external application using
sd-dde-request
.
(oli:sd-dde-execute dde "[Select(\"r1c1:r2c2\")]")) ;; select range
In phase 3, you close the session using
sd-dde-close
.
(oli:sd-dde-close dde)
--
ClausBrod - 21 Jul 2005
to top