StartHotLink

Description

Establishes a hot link with a DDE server application so that PowerBuilder is notified immediately of any changes in the specified data. When the data changes in the server application, it triggers a HotLinkAlarm event in the current application.

Syntax

StartHotLink ( location, applname, topic {, bAnsi} )

Argument

Description

location

A string whose value is the location of the data in which a change of value triggers a HotLinkAlarm event. The format of the location depends on the application that contains the data.

applname

A string whose value is the DDE name of the server application.

topic

A string identifying the data or the instance of the application in which a change triggers a HotLinkAlarm event (for example, in Microsoft Excel, the topic name could be the name of an open spreadsheet).

bAnsi

(optional)

A boolean identifying whether the string to get from the DDE server is in ANSI format. If bAnsi is NULL, false, or empty, PowerBuilder will first try to get the data in a UNICODE formatted string. If bAnsi is true, PowerBuilder will try to get the data in an ANSI formatted string.


Return value

Integer.

Returns 1 if it succeeds. If an error occurs, StartHotLink returns a negative integer. Values are:

-1 -- No server

-2 -- Request denied

If any argument's value is null, StartHotLink returns null.

Usage

After establishing a hot link, you can include the following functions in the HotLinkAlarm event:

  • GetDataDDEOrigin -- To determine what application sent the notification of changed data

  • GetDataDDE -- To obtain the new data

  • RespondRemote -- To acknowledge receipt of the data

Examples

In this example, another PowerBuilder application has called the StartServerDDE function and identified itself as MyPBApp. This statement in your application establishes a hot link to data in MyPBApp. The values you specify for location and topic depend on conventions established by MyPBApp:

StartHotLink("Any", "MyPBApp", "Any")

This statement establishes a hot link with Microsoft Excel, which notifies the PowerBuilder window when the data at row 1 column 2 of REGION.XLS changes:

StartHotLink("R1C2", "Excel", "Region.XLS")

See also

StopHotLink