| **Navigation:**  [[introduction.htm|Language Reference]] > App A - DDE, OLE, and OCX > DDE Procedures >====== DDEWRITE (provide data to DDE client) ====== | [[ddevalue return data value sent to server .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[object linking and embedding.htm|{{btn_next_n.gif|Next page}}]] | | || **DDEWRITE(** //channel, mode, item //[, //variable// ] **)** {{blk2blue.jpg|blk2blue.jpg}} | **DDEWRITE** | Provide data to an open DDE server channel. | | //channel// | A LONG integer constant or variable containing the server channel--the value returned by the DDESERVER procedure. | | //mode// | An integer constant or variable containing the interval (in seconds) to poll for changes to the //variable//, or 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 provide. | | //variable// | The name of the variable providing the data. If omitted and //mode// is DDE:remove, all links to the //item// are canceled. | The **DDEWRITE** procedure allows a DDE server program to provide the //variable's// data to the client. The //item// parameter supplies a string value that identifies the specific data item being provided. The format and structure of the //item// string is dependent upon the //server// application. The type of update performed is determined by the //mode// parameter. If the //mode// is DDE:auto, the client program receives the current value of the variable and the internal libraries continue to provide that value whenever the client (or any other client) asks for it again. If the client requested a "hot" link, any changes to the //variable// should be tracked by the Clarion program so it can issue a new DDEWRITE statement to update the client with the new value. If the //mode// is DDE:manual, the //variable// is updated only once. If the client requested a "hot" link, any changes to the //variable// should be tracked by the Clarion program so it can issue a new DDEWRITE statement to update the client with the new value. PROP:DDETimeOut can be used to set or get the time out value for the DDE connection (default is five seconds). If the //mode// is a positive integer, the internal libraries check the value of the //variable// whenever the specified number of seconds has passed. If the value has changed, the client is automatically updated with the new value by the internal libraries (without the need for any further Clarion code). This can incur significant overhead, depending upon the data, and so should be used only when necessary. If the //mode// is DDE:remove, any 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:** | EVENT:DDErequest | A client has requested a data item (a "cold" link). | | EVENT:DDEadvise | A client has requested continuous updates of a data item (a "hot" link). | **Example:** **DDERetVal  STRING(20)** **WinOne     WINDOW,AT(0,0,160,400)** **            ENTRY(@s20),USE(DDERetVal)** **           END** **MyServer   LONG** ** CODE** ** OPEN(WinOne)** ** MyServer = DDESERVER('MyApp','DataEntered')   !Open as server** ** ACCEPT** **  CASE EVENT()** **  OF EVENT:DDErequest                          !As server for data requested once** **   ****DDEWRITE****(MyServer,DDE:manual,'DataEntered',DDERetVal)   !Provide data once** **  OF EVENT:DDEadvise                           !As server for constant update request** **   ****DDEWRITE****(MyServer,15,'DataEntered',DDERetVal)** **                                               !Check for change every 15 seconds** **                                               !and provide data whenever changed** **  END** ** END** **See Also:** [[ddequery return registered dde servers .htm|DDEQUERY]] [[dderead get data from dde server .htm|DDEREAD]] [[ddeserver return dde server channel .htm|DDESERVER]]