DDE
Description: | Returns the value of the data for a specific item from a DDE server program. This function is a DDE client. |
Returns: | Varies |
Usage: | Steady State only. |
Function Groups: | DDE |
Related to: | DDEPoke | DDEShareAdd | DDEShareDel | SetDDEServer |
Format: | DDE(Program, Topic, Item[, Error, Trigger, pollTimeOut]) |
Parameters: |
Program |
Required. Any text expression giving the name of the program which is the DDE server. This does not contain the .EXE extension. This is usually the same as the root file name of the executable file, but may be different as in the case of Microsoft Word for Windows 6.0 which uses the name "MSWord". For NetDDE, the program name is of the form "\\Computer\NDDE$" where "Computer" is the name of the computer where the DDE server program is running. |
Topic |
Required. Any text expression giving the DDE topic name within the server. For a VTScada server the topic name is usually the name of the window. For Microsoft Excel, the topic is the spreadsheet name. For NetDDE, the topic name is the DDE share name set up in the Windows [ddeshares] section of the SYSTEM.INI file. This configuration section relates a network share name to a program name and individual topic in the DDE server. The SYSTEM.INI must be configured in the DDE server to enable NetDDE. |
Item |
Required. Any text expression giving the location or name of the value to retrieve. |
Error |
Optional. A variable that will be set when an error occurs. Values may be as follows: 0=OK, -1=DDE is stopping, -2=FAILED |
Trigger |
Optional. If present, this indicates a "COLD" link as opposed to a "HOT" link (i.e. you have to poll the server to get an update, rather than it pushing updates to you). When set to 1, this triggers a poll. The trigger is then reset. |
pollTimeOut |
Optional. If this is a COLD link (see Trigger) then pollTimeOut is the value in seconds of the time out for the poll. |
Comments: | This sets up a DDE client. After the link is established, the return value of the function will change whenever the value in the DDE server changes. |
Example:
cellValue = DDE("Excel", "Sheet1", "R1C1");
Upon execution of this statement, cellValue will contain the value of the cell in row 1, column 1 of the Excel spreadsheet called "Sheet1".