Win32 Shell Dynamic Data Exchange (DDE) Interface

ID: Q105446


The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API), included with:
    • Microsoft Windows NT versions 3.5, 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 query words: 3.10 3.50

Keywords :
Version : winnt:3.5,3.51
Platform : winnt
Issue type :


Last Reviewed: January 18, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.