Win32 Shell Dynamic Data Exchange (DDE) Interface

Last reviewed: November 2, 1995
Article ID: Q105446
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT versions 3.5 and 3.51
    

SUMMARY

Information on the DDE Interface to Program Manager can be found in the Win32 application programming interface (API) reference under the topic "Shell Dynamic Data Exchange Interface."

The SDK contains a sample program that interfaces with Program Manager. The sample can be found in MSTOOLS\SAMPLES\DDEML\DDEPROG.

MORE INFORMATION

AppProperties cannot be used to get the item icon, description, or working directory, as it can in Windows 3.1. Therefore, GetIcon(), GetDescription(), and GetWorkingDir() do not work in Windows NT. However, AppProperties can still be used to dump out the contents of a group, by specifying the group name in lParam.

Here's how a Win32-based application can get the item icon, the description, and the working directory:

  1. Initiate a conversation with the Shell as follows

          SendMessage( -1, WM_DDE_INITIATE, hWndApp, lParam );
    

    where lParam points to an atom representing:

          LOWORD | HIWORD
          -----------------------------------------------------------
    

          Shell  | AppIcon        : To get an item's icon
          Shell  | AppDescription : To get an item's description
          Shell  | AppWorkingDir  : To get an item's working directory
    
    

  2. Get the item DDE number.

    The DDE number is stored by Program Manager in the STARUPINFO structure of the application when the application is started. The application can get the startup information with:

          GetStartupInfo( &StartupInfo );
    

    The field lpReserved in the STARUPINFO structure is in the following format

          dde.#, hotkey.##
    

    where the DDE number is # and the hot key for the item is ##.

  3. Request data as follows

          SendMessage( hwndProgMan, WM_DDE_REQUEST, hwndApp, lParam );
    

    where the lParam HIWORD is the item's DDE number obtained in step 2.

  4. The data is returned in lParam of WM_DDE_DATA message. The DDE data value is a string for AppDescription and AppWorkingDir DDE transactions. For AppIcon, the data value has the following structure:

          typedef struct _PMIconData {
    
             DWORD dwResSize;
             DWORD dwVer;
             BYTE iResource;  // icon resource
          } PMICONDATA, *LPPMICONDATA;
    
       To create the icon, the application must call:
    
          hIcon = CreateIconFromResource((LPBYTE)&(lpPMIconData->iResource),
                      lpPMIconData->dwResSize,
                      TRUE,
                      lpPMIconData->dwVer
                  );
    


Additional reference words: 3.10 3.50
KBCategory: kbui
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: November 2, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.