StartServerDDE

Description

Establishes your application as a DDE server. You specify the DDE name, topic, and items that you support.

Syntax

StartServerDDE ( { windowname, } applname, topic {, item } )

Argument

Description

windowname (optional)

The name of the server window. The default is the current window.

applname

The DDE name for your application.

topic

A string whose value is the basic data grouping the DDE client application references.

item (optional)

A comma-separated list of one or more strings (data within topic) that specify what your DDE server application supports (for example, "Table1","Table2").

Returns

Integer. Returns 1 if it succeeds. If an error occurs, StartServerDDE returns -1, meaning the your application is already started as a server. If any argument’s value is null, StartServerDDE returns null.

Usage

When a DDE client application sends a DDE request, the request includes one of the items you have declared that you support. You determine how your application responds to each of those items.

A window must be open to provide a handle for the DDE conversation. You cannot call StartServerDDE and other DDE functions in an application object’s events.

When your application has established itself as a DDE server, other applications can send DDE requests that trigger these events in your application.

Table 10-10: Events triggered by DDE requests and DDE functions available to each event

Client action

Event triggered

Functions available

Purpose of function

Sends a request for a hot link

RemoteHotLinkStart

Sends a command to your application

RemoteExec

GetCommandDDE

GetCommandDDEOrigin

Obtain the command

Find out what client application sent the command

Sends data

RemoteSend

GetDataDDE

GetDataDDEOrigin

Obtain the data

Find out what client application sent the data

Requests data from your server application

RemoteRequest

SetDataDDE

RespondRemote

Send the requested data

Acknowledge the request

Wants to terminate the hot link

RemoteHotLinkStop

Examples

Example 1

This statement causes your PowerBuilder application to begin acting as a server. It is known to other DDE applications as MyPBApp; its topic is System, and it supports items called Table1 and Table2:

StartServerDDE(w_emp, "MyPBApp","System", &

   "Table1", "Table2")

See also