The information in this article applies to:
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:
- 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
- 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 ##.
- 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.
- 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
);
|