Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/105446

From BetaArchive Wiki

Win32 Shell Dynamic Data Exchange (DDE) Interface


The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API), included with:
    • the operating system: Microsoft Windows NT, versions 3.5, 3.51


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.


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

    To create the icon, the application must call:

          hIcon = CreateIconFromResource((LPBYTE)&(lpPMIconData->iResource),

Additional query words: 3.10 3.50

Keywords :
Issue type :
Technology : kbAudDeveloper kbWin32sSearch kbWin32API

Last Reviewed: October 27, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.