Help and Support
 

powered byLive Search

Win32 Shell Dynamic Data Exchange (DDE) Interface

Article ID:105446
Last Review:November 21, 2006
Revision:3.1
This article was previously published under Q105446

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
              );

APPLIES TO
Microsoft Win32 Application Programming Interface, when used with:
  Microsoft Windows NT 4.0
  Microsoft Windows NT 3.51 Service Pack 5

Back to the top

Keywords: 
KB105446

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by E-mail, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.