User Tools

Site Tools


ddeclient_return_dde_client_channel_.htm
Navigation:  Language Reference > App A - DDE, OLE, and OCX > DDE Procedures >====== DDECLIENT (return DDE client channel) ====== Previous pageReturn to chapter overviewNext page

DDECLIENT( [ application ] [, topic ] )

blk2blue.jpg

DDECLIENT Returns a new DDE client channel number.
application A string constant or variable containing the name of the server application to link to. Usually, this is the name of the application. If omitted, the first DDE server application available is used.
topic A string constant or variable containing the name of the application-specific topic. If omitted, the first topic available in the application is used.

The DDECLIENT procedure returns a new DDE client channel number for the application and topic. If the application is not currently executing, DDECLIENT returns zero (0).

Typically, when opening a DDE channel as the client, the application is the name of the server application. The topic is a string that the application has either registered with Windows as a valid topic for the application, or represents some value that tells the application what data to provide. You can use the DDEQUERY procedure to determine the applications and topics currently registered with Windows.

Return Data Type:     LONG

Example:

DDEReadVal  REAL

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

        ENTRY(@s20),USE(DDEReadVal)

       END

ExcelServer LONG

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

 RETURN                               !and try again

END

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

ACCEPT

 CASE EVENT()

 OF EVENT:DDEdata                     !As changed data comes from Excel

  PassedData(DDEReadVal)              !process the new data

 END

END

See Also:

DDEQUERY

DDEWRITE

DDESERVER

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