(Windows only)
Opens a dynamic data exchange (DDE) client conversation for a specified DDE server application and topic, and associates the new conversation with an ABL frame. To identify the conversation, the statement returns an integer as a unique channel number for this conversation.
This statement is supported only for backward compatibility. Use the Component Object Model (COM) instead.
Note: Does not apply to SpeedScript programming.
Syntax
DDE INITIATE ddeid FRAME frame-handle
APPLICATION server-name TOPIC topic-name[ NO-ERROR ]
|
-
ddeid-var
- An integer variable or field that receives the channel number
for the newly opened DDE conversation.
- FRAME frame-handle
- Specifies the handle of the frame that owns the conversation, where
frame-handle is a HANDLE expression. A frame can
own more than one conversation. The AVM records the status of the most recent
conversation exchange in a set of DDE frame attributes. These attributes record the
status of every dynamic data exchange, including advise exchanges (exchanges triggered
by DDE-NOTIFY events). The DDE frame attributes include:
-
DDE-ERROR — The DDE error code returned by the most recent
exchange
-
DDE-ID — The channel number of the conversation that had the
most recent exchange
-
DDE-ITEM — The name of the data item referenced by the most
recent exchange
-
DDE-NAME — The name of the server application in the most
recent exchange
-
DDE-TOPIC — The name of the topic of the most recent
exchange
- APPLICATION server-name
- Specifies the name of the server application for the conversation, where
server-name is a character expression. The value of
server-name must be unique for each DDE server on your system. It
is usually the filename of the server executable without the extension (for example, the
name EXCEL in Microsoft Excel).
- TOPIC topic-name
- Specifies the name of the topic of the conversation, where
topic-name is a character expression. The value of
topic-name identifies a category defined by the server application.
This is usually the name of a file or other container that includes one or more data
items (for example, the name of a worksheet, such as Sheet1 in Microsoft Excel). An ABL
client can only exchange data with server data items included in the topic of an open
conversation.
- NO-ERROR
- The NO-ERROR option is used to prevent the
statement from raising ERROR and displaying error
messages.
Regardless of whether NO-ERROR is used, the AVM posts the
error to the DDE frame DDE-ERROR attribute.
Example
The following fragment shows a typical use of the DDE
INITIATE statement. It assumes that the Microsoft Excel application is running,
and has created the default Excel worksheet, Sheet1. It then uses the DDE
INITIATE statement to open a conversation with Sheet1 as the topic. This allows
the AVM to exchange data with the cells of the worksheet. In this example, the fragment
assigns column headings to the top row of the first three columns in the worksheet:
DEFINE VARIABLE Sheet1 AS INTEGER NO-UNDO. /* DDE-ID to worksheet topic */
DEFINE VARIABLE DDEframe AS HANDLE NO-UNDO. /* DDE frame handle */
/* Create DDE frame */
CREATE FRAME DDEframe
ASSIGN visible = TRUE
hidden = TRUE.
. . .
/* Open a DDE conversation with Sheet1 and assign column headings. */
DDE INITIATE Sheet1 FRAME DDEframe APPLICATION "Excel" TOPIC "Sheet1".
DDE SEND Sheet1 SOURCE "Name" ITEM "R1C1".
DDE SEND Sheet1 SOURCE "YTD Sales" ITEM "R1C2".
DDE SEND Sheet1 SOURCE "State" ITEM "R1C3".
. . .
|
Notes
- The specified DDE server application must be running on the Windows
desktop before you can invoke the DDE INITIATE statement.
- You can close a DDE conversation in three ways: use the DDE
TERMINATE statement, leave the scope of the frame that owns the conversation,
or terminate the server application or topic associated with the application.
- For more information on using the DDE protocol (including DDE frame
attributes) to exchange data with non-ABL applications, see OpenEdge External Programming Interface Reference.