|Navigation: Language Reference > App A - DDE, OLE, and OCX > DDE Procedures >====== DDEREAD (get data from DDE server) ======|
DDEREAD( channel, mode, item [, variable ] )
|DDEREAD||Gets data from a previously opened DDE client channel.|
|channel||A LONG integer constant or variable containing the client channel–the value returned by the DDECLIENT procedure.|
|mode||An EQUATE defining the type of data link: DDE:auto, DDE:manual, or DDE:remove (defined in EQUATES.CLW).|
|item||A string constant or variable containing the application-specific name of the data item to retrieve.|
|variable||The name of the variable to receive the retrieved data. If omitted and mode is DDE:remove, all links to the item are canceled.|
The DDEREAD procedure allows a DDE client program to read data from the channel into the variable. The type of update is determined by the mode parameter. The item parameter supplies some string value to the server application that tells it what specific data item is being requested. The format and structure of the item string is dependent upon the server application.
If the mode is DDE:auto, the variable is continually updated by the server (a “hot” link). An EVENT:DDEdata is generated each time the variable is updated by the server.
If the mode is DDE:manual, the variable is updated once and no event is generated. Another DDEREAD request must be sent to the server to check for any changed value (a “cold” link).
If the mode is DDE:remove, a previous “hot” link to the variable is terminated. If the mode is DDE:remove and variable is omitted, all previous “hot” links to the item are terminated, no matter what variables were linked. This means the client must send another DDEREAD request to the server to check for any changed value.
|601||Invalid DDE Channel|
|602||DDE Channel Not Open|
These events are posted to the client application:
|EVENT:DDEdata||A server has supplied an updated data item for a hot link.|
|EVENT:DDEclosed||A server has terminated the DDE link.|
!Open as client to Excel spreadsheet
ExcelServer = DDECLIENT('Excel','MySheet.XLS')
IF NOT ExcelServer !If the server is not running
MESSAGE('Please start Excel') !alert the user to start it
!Request continual update from server:
OF EVENT:DDEdata !As changed data comes from Excel
PassedData(DDEReadVal) ! call proc to process the new data