Navigation: Language Reference > App A - DDE, OLE, and OCX > DDE Procedures >====== DDEQUERY (return registered DDE servers) ====== | |
DDEQUERY( [ application ] [, topic ] )
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)