WM_DDE_INITIATE

2.x

#include <dde.h>

WM_DDE_INITIATE
wParam = (WPARAM) hwnd;                    /* sending window's handle */
lParam = MAKELPARAM(aApplication, aTopic); /* application and topic   */

A dynamic data exchange (DDE) client application sends a WM_DDE_INITIATE message to initiate a conversation with server applications responding to the specified application and topic names.

Upon receiving this message, all server applications with names that match the aApplication application and that support the aTopic topic are expected to acknowledge it (see the WM_DDE_ACK message).

Parameters

hwnd

Value of wParam. Identifies the sending window.

aApplication

Value of the low-order word of lParam. Specifies the name of the application with which a conversation is requested. The application name cannot contain slash marks (/) or backslashes (\). These characters are reserved for future use in network implementations. If aApplication is NULL, a conversation with all applications is requested.

aTopic

Value of the high-order word of lParam. Specifies the topic for which a conversation is requested. If the topic is NULL, a conversation for all available topics is requested.

Return Value

This message does not return a value.

Comments

If aApplication is NULL, any application can respond. If aTopic is NULL, any topic is valid. Upon receiving a WM_DDE_INITIATE request with the aTopic parameter set to NULL, an application is expected to send a WM_DDE_ACK message for each of the topics it supports.

Sending

The application sends the WM_DDE_INITIATE message by calling the SendMessage function, not the PostMessage function. The application broadcasts the message to all windows by setting the first parameter of SendMessage to –1, as shown:

SendMessage(-1, WM_DDE_INITIATE, hwndClient, MAKELONG(aApp, aTopic));

If the application has already obtained the window handle of the desired server, it can send WM_DDE_INITIATE directly to the server window by passing the server's window handle as the first parameter of SendMessage.

The application allocates aApplication and aTopic by calling GlobalAddAtom.

When SendMessage returns, the application deletes the aApplication and aTopic atoms.

Receiving

To complete the initiation of a conversation, the application responds with one or more WM_DDE_ACK messages, where each message is for a separate topic. When sending a WM_DDE_ACK message, the application creates new aApplication and aTopic atoms; it should not reuse the atoms sent with the WM_DDE_INITIATE message.

See Also

GlobalAddAtom, SendMessage, WM_DDE_ACK