1. Select "DDE Server" from WinWedge "Mode" menu.
When the dialog box appears asking for a DDE Command Destination
Application, enter: "QPW" as the Application
Name and then enter "SYSTEM" as the DDE
topic.
2. Select "Input Record Structure" in the "Define" menu
and define the structure of the input record(s) to WinWedge.
When you get to the final Window entitled "Input Record
Definition Editor", enter the string: {Get_Wedge_Data} as
the Field Postamble DDE Command after the last data field
that you have defined. This is a DDE command that will be
sent to Quattro Pro after each data record is received by
the Wedge.
3. Set up the rest of WinWedge parameters and activate
it.
Quattro Pro does not have a "Get_Wedge_Data" DDE
command so the first step is to create one. When you create
and name a macro in a Quattro Pro notebook, the name of the
macro automatically becomes a valid Quattro Pro DDE command
for as long as the notebook is open.
1. Enter the following lines into cells in a Quattro
Pro notebook and name
each cell or group of cells using the block names indicated
below.
| |
Block Name Block Contents
row 1
column A
cell_number A1
dde_channel 0
dde_command [beep]
result 0
get_wedge _data {ONERROR _error_handler}
{REQUEST
dde_channel,"FIELD(1)",@@("cell_number")}
{LET row,row+1}
{LET cell_number,+column&@string(row,0)}
{EXECUTE dde_channel,+dde_command,result}
_error_handler {INITIATE
"WinWedge","COM1",dde_channel}
|
This example sets up WinWedge to issue a DDE command to
Quattro Pro consisting of the name of a macro (get_wedge_data)
after each data record is received from your serial device.
The macro performs a DDE Request to WinWedge that returns
the contents of FIELD(1) to a spreadsheet cell pointed to
by the variables named "row" and "column".
(i.e. row 1, column A)
The blocks with the names "row", "column", "cell_number", "dde_channel", "dde_command" and "result" are
simply variables that are used by the "get_wedge_data" macro.
The "get_wedge_data" macro first sets up an error
handler pointing to the macro named "_error_handler".
The following line then attempts to request the data for "Field(1)" from
WinWedge and store the data in a cell whose address is pointed
to by the variable "cell_number". The first time
the macro is invoked the "request" command will
fail because a DDE channel has not yet been opened. The purpose
of the "_error_handler" macro is to simply initiate
the DDE channel when the first call to "get_wedge_data" fails.
After the "request" macro command, the variable "row" is
incremented and the variable "cell_number" is updated
using the new row number so that it points to the cell directly
below the one where the last data reading from WinWedge was
stored. Thus, each time a new data record is received by
WinWedge, the contents of "Field(1)" will be retrieved
and stacked up in a column. The final macro line in the "get_wedge_data" macro
uses Quattro Pros "Execute" command to issue
a "Beep" command to WinWedge. This line has been
included as an example of how to send DDE commands to WinWedge
from Quattro Pro. |