Using DDE in an Application

About this chapter

This chapter describes how PowerBuilder supports DDE.

About DDE

Dynamic Data Exchange (DDE) makes it possible for two Windows applications to communicate with each other by sending and receiving commands and data. Using DDE, the applications can share data, execute commands remotely, and check error conditions.

PowerBuilder supports DDE by providing PowerScript events and functions that enable a PowerBuilder application to send messages to other DDE-supporting applications and to respond to DDE requests from other DDE applications.

Clients and servers

A DDE-supporting application can act as either a client or a server.

About the terminology

Used in connection with DDE, these terms are not related to client/server architecture, in which a PC or workstation client communicates with a database server.

A client application makes requests of another DDE-supporting application (called the server). The requests can be commands (such as open, close, or save) or requests for data.

A server application is the opposite of a client application. It responds to requests from another DDE-supporting application (called the client). As with client applications, the requests can be commands or requests for specific data.

A PowerBuilder application can function as a DDE client or as a DDE server.

In PowerBuilder, DDE clients and servers call built-in functions and process events. DDE events occur when a command or data is sent from a client to a server (or from a server to a client).

DDE functions and events

The following tables list the DDE functions and events separated into those functions and events used by DDE clients and those used by DDE servers. For more information on DDE support, see the PowerScript Reference.

Return values

Every DDE function returns an integer.

DDE client

Function

Action

CloseChannel

Closes a channel to a DDE server application that was opened using OpenChannel.

ExecRemote

Asks a DDE server application to execute a command.

GetDataDDE

Obtains the new data from a hot-linked DDE server application and moves it into a specified string.

GetDataDDEOrigin

Determines the origin of data that has arrived from a hot-linked DDE server application.

GetRemote

Asks a DDE server application for data. This function has two formats: one that uses a channel and one that does not.

OpenChannel

Opens a DDE channel to a specified DDE server application.

RespondRemote

Indicates to the DDE server application whether the command or data received from the DDE application was acceptable to the DDE client.

SetRemote

Asks a DDE server application to set an item such as a cell in a worksheet or a variable to a specific value. This function has two formats: one that uses a DDE channel and one that does not.

StartHotLink

Initiates a hot link to a DDE server application so that PowerBuilder is immediately notified of specific data changes in the DDE server application.

StopHotLink

Ends a hot link with a DDE server application.


Event

Occurs when

HotLinkAlarm

A DDE server application has sent new (changed) data.


DDE server

Function

Action

GetCommandDDE

Obtains the command sent by a DDE client application

GetCommandDDEOrigin

Determines the origin of a command from a DDE client

GetDataDDE

Gets data that a DDE client application has sent and moves it into a specified string

GetDataDDEOrigin

Determines the origin of data that has arrived from a hot-linked DDE client application

RespondRemote

Indicates to the sending DDE client application whether the command or data received from the DDE application was acceptable to the DDE server

SetDataDDE

Sends specified data to a DDE client application

StartServerDDE

Causes a PowerBuilder application to begin acting as a DDE server

StopServerDDE

Causes a PowerBuilder application to stop acting as a DDE server


Event

Occurs when

RemoteExec

A DDE client application has sent a command

RemoteHotLinkStart

A DDE client application wants to start a hot link

RemoteHotLinkStop

A DDE client application wants to end a hot link

RemoteRequest

A DDE client application has requested data

RemoteSend

A DDE client application has sent data