User Tools

Site Tools


dderead_get_data_from_dde_server_.htm
Navigation:  Language Reference > App A - DDE, OLE, and OCX > DDE Procedures >====== DDEREAD (get data from DDE server) ====== Previous pageReturn to chapter overviewNext page

DDEREAD( channel, mode, item [, variable ] )

blk2blue.jpg

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.

Errors Posted:

601 Invalid DDE Channel
602 DDE Channel Not Open
605 Time Out

Events Generated:

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.

Example:

WinOne  WINDOW,AT(0,0,160,400)

       END

ExcelServer LONG(0)

DDEReadVal  REAL

CODE

OPEN(WinOne)

!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

 CLOSE(WinOne)

 RETURN

END

!Request continual update from server:

DDEREAD(ExcelServer,DDE:auto,'R5C5',DDEReadVal)

ACCEPT

 CASE EVENT()

 OF EVENT:DDEdata         !As changed data comes from Excel

  PassedData(DDEReadVal)     ! call proc to process the new data

 END

END

See Also:

DDEQUERY

DDEWRITE

DDESERVER

dderead_get_data_from_dde_server_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1