Sample Application Demonstrates Using DDEML

Last reviewed: February 15, 1996
Article ID: Q82077
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) for Windows versions 3.1 and 3.0

SUMMARY

DMLDEMO is a file in the Microsoft Software Library that demonstrates how two applications for the Windows environment can communicate using the Dynamic Data Exchange Management Libraries (DDEML). DMLDEMO demonstrates the following types of transactions:

  • Connect
  • Request
  • Asynchronous Request
  • Hot Advise Loop
  • Warm Advise Loop

Download DMLDEMO.EXE from the Microsoft Software Library (MSL) on the following services:
  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download DMLDEMO.EXE (size: 76247 bytes) 
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the \SOFTLIB\MSLFILES directory
          Get DMLDEMO.EXE (size: 76247 bytes) 
    

NOTE: The DMLDEMO file contains code for a client application and for a server application in separate directories. To preserve the directory structure, be sure to specify the -d option when extracting the files. For example,

   dmldemo -d

MORE INFORMATION

The remainder of this article details the five transaction types.

Connect Transaction

The client calls the DdeConnect function to connect to the server and initiate a conversation. In the DMLDEMO application, the DdeConnect function starts a general conversation, which deals with text and bitmaps, and a SYSTEM conversation, which supports the system topic.

Request Transaction

When the client requires information from the server, the client calls the DdeClientTransaction function, specifying XTYP_REQUEST as the value for the uType parameter. The DMLDEMO client uses a request transaction to retrieve the number and type of bitmaps to display. The request transaction is used in both synchronous and asynchronous contexts.

Asynchronous Transaction

The client starts an asynchronous transaction with the server to request information that may not be ready at the time the client makes the request.

In the DMLDEMO application, the client starts an asynchronous transaction when the user chooses Asynchronous Transaction from the Transactions menu. When the server receives the request (as an XTYP_REQUEST transaction), it displays a dialog box that asks the user how many copies of the window bitmap the client should display. After the user dismisses the dialog box, the server returns a data handle containing the number the user selected from its callback function. When the server has completed the transaction, the DDEML sends an XTYP_XACT_COMPLETE to the client application's callback function. The client then displays the requested number of bitmaps.

In this case, an asynchronous transaction is required to prevent the transaction from timing out before the user has a chance to close the dialog box.

Hot Advise Loop

When a hot advise loop is established between a client and a server, the server notifies the client (through an XTYP_ADVDATA transaction) each time a certain piece of data changes. The notification includes a handle to the changed data. When a hot advise loop is active in the DMLDEMO application, the server notifies the client that the bitmap has changed (this notification includes a handle to the changed bitmap) every time the server's bitmap is changed. (To change the bitmap, choose Change Bitmap from the server application's menu.) The client application then displays the bitmap.

Warm Advise Loop

When a warm advise loop is established between a client and a server, the server notifies the client that the specified data has changed, but the server does not send the changed data to the client. In the DMLDEMO application, when the client receives a notification from the server, the client brings up a message box asking the user if the client's window should be updated with the new bitmap from the server. If the user chooses the "Yes" button, the client requests the changed bitmap from the server using the DdeClientTransaction function, specifying XTYP_REQUEST as the value of the uType parameter.


Additional reference words: 3.00 3.10 softlib DMLDEMO.ZIP
KBCategory: kbprg kbfile
KBSubcategory: UsrDde


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 15, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.