![]() | ![]() | Application Development |
Prolifics supports Windows Dynamic Data Exchange (DDE), which lets applications share data through client/server links. Prolifics supports both client and server links with other applications. As a DDE server, a Prolifics application exports data from a field. As a DDE client, it imports data from another application into a field.
Prolifics as a DDE Server | ![]() |
As a DDE server, Prolifics can export data from a named field to a client application. The client application specifies a DDE service, topic and item. In Prolifics, these correspond to the application name, screen name and field name, respectively.
For example, an Excel spreadsheet can request a link between one of its cells and a Prolifics field. The request must include the name of the Prolifics server name, the screen name, and the field name. If the request succeeds, a DDE connection is created between that spreadsheet window and the Prolifics screen; this connection initially consists of the requested link, and can also accommodate other links that the client might request later.
Before a client application can request links to a Prolifics application, two conditions must be true:
To enable Prolifics as a server, call Clients can create links to a Prolifics screen either through the clipboard or by explicitly issuing a request.
You can use the Windows clipboard data to create a link to a Prolifics application:
sm_dde_server_on or include this setting in the initialization file prol5w32.ini:
DDEServer=on
Creating Links
Paste Links
You can also create links to a Prolifics screen through explicit requests in the client application's DDE syntax. Refer to your client application's documentation for details on its DDE syntax.
Notes: Prefix the topic name with ampersands (& or &&) if you want the Prolifics screen to open as a stacked or sibling window.
The following examples show DDE syntax for several widely used Windows applications:
@DDELINK([myProlApp|&&mainScreen.jam]"totalData")
{DDEAUTO myProlApp &mainScreen.jam totalData }
=myProlApp|mainScreen.jam!totalData
It is the client application's responsibility to connect with a Prolifics screen and create links to the required fields. Most client applications automatically establish a connection when they request a link.
When DDE gets a link request that is intended for a Prolifics application, it processes it as follows:
Links remain in effect until they are explicitly closed by the client or the Prolifics application exits. Prolifics maintains links for a screen that is inactive or closed, and resumes data updates when the screen reopens. The client's connection to a Prolifics screen remains active until all links to the current screen are destroyed.
Prolifics destroys links only at the request of the client or when the Prolifics application terminates. When the client destroys its last link to a screen, its connection to that screen is broken.
A client can create three kinds of links to Prolifics fields:
Prolifics automatically updates the client with new data as soon as linked field data changes. Hot links are maintained only for fields on the active screen.
Prolifics notifies the client when linked field data changes. The client must then request the data. Notice is sent only for fields on the active screen. Requests for data succeed only if the linked field is on an active screen or in the LDB.
Prolifics updates the client with new field data only when the client requests it. Requests for data succeed only if the linked field is on an active screen or in the LDB.
If the linked field is an array, Prolifics supplies all occurrences in the array. Occurrences are separated by carriage returns () and newlines (). Leading blanks in right-justified fields and trailing blanks in left-justified fields are omitted.
Prolifics supplies text data to client applications. It is the client's responsibility to perform any necessary data conversion such as string to numeric. For example, if the client is a Microsoft Excel spreadsheet, the spreadsheet cell should wrap the formula for the DDE reference in a value function call as below; this converts the link text data into a number:
=value(JAM|screen.jam!textdata)
Other methods are specific to each client application.
You can disable Prolifics as a server at runtime through sm_dde_server_off. Prolifics continues to maintain all previous links to clients; however, it ignores all client requests that are made after this call.
Prolifics as a DDE Client | ![]() |
When a Prolifics application acts as a DDE client, it imports data into fields from an external server application. Prolifics can request hot, warm, and cold links.
DDE can maintain multiple connections between the Prolifics application and server application; only one connection is allowed between a Prolifics screen and a given server window. Each connection can maintain multiple links.
For example, a Prolifics screen can request a hot link between one of its fields and a cell in an Excel spreadsheet. The request must include the name of the Excel program, the spreadsheet's filename, and the cell identifier. If the request succeeds, a DDE connection is created between the Prolifics screen and the specified spreadsheet; this connection initially consists of the requested link, and can also accommodate other links that the client might request later. Subsequent changes in the server cell data are reported to Prolifics and automatically are written to its linked field.
Before Prolifics can connect to a server application, it must be enabled as a DDE client. To enable Prolifics as a client, call sm_dde_client_on or include this setting in the initialization file prol5w32.ini:
DDEClient=on
As a DDE client, Prolifics can request hot, warm, and cold links. For more on link types, refer to page . You can create links in three ways:
You can paste server data from the Windows clipboard into a Prolifics field on the active screen with one of these Prolifics paste link functions:
Paste Links
sm_dde_client_paste_link_hot
These functions take a single argument—the field to get server data. Prolifics gets the actual data and link information from the clipboard—server, topic, and item—and paste links the data into the specified field.
Prolifics also provides a set of library functions that explicitly specify the server data required:
Explicit Links Through Library Functions
sm_dde_client_connect_hot
These functions take four arguments: the server, topic, item, and target Prolifics field. The format for server, topic, and item arguments is specific to each server application. Refer to the server application's documentation for this information. on page 46-7 shows the syntax used by three widely used Windows applications.
For example, the following JPL statement creates a cold link between a Prolifics client and an Excel spreadsheet:
Refer to Programming Guide for more information about these functions.
You can use the initialization file to create hot links. This lets you specify and edit links for an application without changing the screens themselves. Only hot links are supported from the initialization file.
The initialization file for Prolifics contains a Prolifics DDE section, where you can specify links to server applications as follows:
For example, a link to a Quattro Pro spreadsheet might look like this:
The format for server, topic, and item arguments is specific to each server application. Refer to the server application's documentation for this information. Table 46-1 shows the syntax used by three widely used Windows applications.
A link request from a Prolifics application consists of these steps:
retval = sm_dde_client_connect_cold \
> ("Excel","C:\XL\SALES.XLS","R1C2","total") Links Specified in Initialization File
screenname !
fieldname =
service |
topic !
item
salesScrn!totalSales=QPW|C:\MyAcct\Sales.wb1!$A:$A$10..$A$10
Processing Link Requests
If a link request fails for any reason—for example, because the server application is not running—Prolifics posts an error message.
Prolifics updates link data according to the link type:
If a field has warm or cold link data, the application must explicitly request updates from the server by calling When warm link data changes, DDE notifies Prolifics that new data is available from the server. Prolifics then calls a callback function—either its own or one installed by the developer—and passes it the screen name and field name of the link. For information about writing callback routines, refer to DDE does not notify the Prolifics client of any changes in cold link data.
Notes:
Because Prolifics tries to update all occurrences in the array with server data. Data flows into the array starting with the first occurrence. When Prolifics reaches the end of the occurrence or encounters a tab, carriage return, or newline in the server data, it skips to the next occurrence. Prolifics eliminates leading white space—tabs, carriage returns, and new lines—before writing the data. The process ends when there is no more data or the end of the array is reached.
When a screen closes, Prolifics destroys all links on that screen. You can also explicitly destroy links on the active screen with Prolifics maintains its connection to a server application as long as an open screen contains a link to that application. When the last screen containing a link to a server closes, Prolifics breaks the connection.
sm_dde_client_request. This function can be called only for fields on the active screen.
sm_dde_install_notify.
sm_dde_request can be called only for widgets on the active screen, an application that uses warm links should queue notices for data on inactive screens.
Array Data
Destroying Links to a DDE Server
sm_dde_client_disconnect.
Disconnecting from a DDE Server
Execute Transactions | ![]() |
The execute transaction lets a client execute a command on a server. As a client, Prolifics can initiate execute transactions on a server application; as a server, Prolifics can be the recipient of commands issued by a client.
As a DDE client, Prolifics can execute a command on a server with which it already has a connection by calling sm_dde_execute:
sm_dde_execute(server,topic,command);
The server decides whether to execute or ignore the command. You can check the function's return value to determine the outcome of the call.
As a server, Prolifics can receive a command issued by a client. For example, a Quattro Pro spreadsheet might contain this EXECUTE statement:
{EXECUTE B1, "^updateData.jpl"}
Prolifics executes the command string like any control string.
For information about specifying execute transactions from client applications, refer to that application's documentation.
Poke Transactions | ![]() |
A poke transaction lets a client send data to a server. As a client, Prolifics can initiate poke transactions on a server application; as a server, Prolifics can be the recipient of commands issued by a client.
As a DDE client, Prolifics can poke data into a server with which it already has a connection by calling sm_dde_poke:
sm_dde_poke(server,topic,item,data);
The server decides whether to execute or ignore the command. You can check the function's return value to determine the outcome of the call.
As a server, Prolifics can be the target of a poke transaction issued by a client. For information about executing poke transactions from client applications, refer to that application's documentation.