ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / DDE functions
  • Connecting to a DDE server
DDEConnect (Example)
Connecting to a DDE server
This code example contains:
  • a client code used to start the DDE server, to send and receive information.
  • a server code corresponding to the procedures of the DDE server.
// Example of client
 
// Connection
ConnectionNum is int
DDEStart(ServerName)
ConnectionNum = DDEConnect(ServerName, "MyTopic")
 
// Prepare to receive some messages
// Processed in the MODIF procedure
DDEEvent("MODIF", DDEtoModify)
// ...
// Runs a server action
DDEExecute(ConnectionNum, "EXE1")
IF DDERetrieve(ConnectionNum, "Item1") THEN
Info("The retrieved data is" + DDEString())
END
 
//...
 
// Sends a value
DDESend(ConnectionNum, "Item2", Value)
 
//...
 
// Disconnection
DDEDisconnect(ConnectionNum)
 
 
// Example of server
 
// Prepare to receive some messages
DDEEvent("ToAnswer", DDEtoAnswer)
DDEEvent("ToReceive", DDEtoReceive)
DDEEvent("ToExecute", DDEtoExecute)// In the server
// Procedure ToExecute to run a process
IF _DDE.Subject = "MySubject" AND _DDE.String = "Exce1" THEN
 _DDE.Cr = 1
 // Process
ELSE
 _DDE.Cr = 0
END
 
 
// On the server
// Procedure ToAnswer to retrieve a value
IF _DDE.Subject = "MySubject" AND _DDE.Item = "Item1" THEN
_DDE.Cr = 1
_DDE.String = ReturnValue
ELSE
_DDE.Cr = 0
END
 
// Procedure ToReceive for sending a value
IF _DDE.Subject = "MySubject" AND _DDE.Item = "Item2" THEN
_DDE.Cr = 1
Info("Received value" + _DDE.String)
ELSE
_DDE.Cr = 0
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help