| **Navigation:**  [[introduction.htm|Language Reference]] > App A - DDE, OLE, and OCX > DDE Procedures >====== DDEQUERY (return registered DDE servers) ====== | [[ddepoke send unsolicited data to dde server .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[dderead get data from dde server .htm|{{btn_next_n.gif|Next page}}]] | | || **DDEQUERY(** [ //application// ] [, //topic// ] **)** {{blk2blue.jpg|blk2blue.jpg}} | **DDEQUERY** | Returns currently executing DDE servers. | | //application// | A string constant or variable containing the name of the application to query. For most applications, this is the name of the application. If omitted, all registered //applications// registered with the specified //topic// are returned. | | //topic// | A string constant or variable containing the name of the application-specific topic to query. If omitted, all //topics// for the //application// are returned. | The **DDEQUERY** procedure returns a string containing the names of the currently available DDE server //applications// and their //topics//. If the //topic// parameter is omitted, all //topics// for the specified //application// are returned. If the //application// parameter is omitted, all registered //applications// registered with the specified //topic// are returned. If both parameters are omitted, DDEQUERY returns all currently available DDE servers. The format of the data in the return string is //application:topic// and it can contain multiple //application// and //topic// pairs delimited by commas (for example, 'Excel:MySheet.XLS,ClarionApp:DataFile.DAT'). **Return Data Type:     **STRING **Example:** ** !This example code does not handle DDEADVISE** **WinOne WINDOW,AT(0,0,160,400)** **       END** **SomeServer   LONG** **ServerString STRING(200)** ** CODE** ** OPEN(WinOne)** ** LOOP** **  ServerString = ****DDEQUERY****()                     !Return all registered servers** **  IF NOT INSTRING('SomeApp:MyTopic',ServerString,1,1)** **   MESSAGE('Open SomeApp, Please')** **  ELSE** **   BREAK** **  END** ** END** ** SomeServer = DDECLIENT('SomeApp','MyTopic')    !Open as client** ** ACCEPT** ** END** ** DDECLOSE(SomeServer)**