CoCreate Modeling FAQ: DDE

How do I talk to CoCreate Modeling via DDE?

CoCreate Modeling services DDE requests, and you can also send DDE requests from CoCreate 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 CoCreate 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 CoCreate 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 CoCreate 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:

  1. Initialization
  2. Communication phase
  3. 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

How do I talk to Excel using DDE?

See the sample code at MacroHelloExcel.

-- ClausBrod - 11 Apr 2007

When asked for a TWiki account, use your own or the default TWikiGuest account.

to top

You are here: CoCreateModeling > OsdmFaq > FaqDde

r1.3 - 24 Jul 2009 - 19:39 - ClausBrod to top

CoCreate ModelingRSS
  Operating system
  Memory management
  File handling
  App. knowhow
Code examples

  • My links
  • Show me topics of interest



TWiki Web TWiki Web Home Changes Topics Index Search

TWiki Webs Atari Blog Main OneSpaceModeling? Sandbox TWiki TWiki Webs Atari Blog Main OneSpaceModeling? Sandbox TWiki


Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback