WinDdeInitiate
This function is issued by a client application to one or more other applications, to request initiation of a dynamic data exchange conversation with a national language conversation context.
Syntax
WinDdeInitiate(hwndClient, pszAppName, pszTopicName, pContext)
Parameters
- hwndClient (HWND) - input
- Client's window handle.
- pszAppName (PSZ) - input
- Application name.
- This is the name of the desired server application. If it is a zero-length string, any application can respond.
- Application names may not contain slashes or backslashes.
- pszTopicName (PSZ) - input
- Topic name.
- This is the name of the desired topic. If it is a zero-length string, each responding application will respond once for each topic which it can support.
- pContext (PCONVCONTEXT) - input
- Conversation context.
Returns
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion. The WM_DDE_INITIATE message is successfully sent to all appropriate windows.
- FALSE
- Error occurred.
Remarks
This function sends a WM_DDE_INITIATE message to all top level frame windows. These are windows registered with CS_FRAME, whose parent is the desktop window. No message is sent to object windows.
The WinDdeInitiate function does not return to the client application until all receiving applications have, in sequence, processed the WM_DDE_INITIATE message, and the client application has received all the corresponding WM_DDE_INITIATEACK messages (see WinDdeRespond).
To support DDE conversations between applications running in different memory models (16-bit and 32-bit) it is necessary to process all DDE messages in the application window procedure. The use of the WinDispatchMsg function ensures that conversion is performed on memory or segment addresses.
Example Code
This example uses WinDdeInitiate to initiate-during the creation of a client window-a dynamic data exchange (DDE) conversation with any available server applications, asking that the server applications respond for each topic they can support. It also allocates the shared memory that will be used once the conversation is established.
#define INCL_WINDDE /* Window DDE Functions */ #define INCL_DOSMEMMGR /* Memory Manager values */ #include <os2.h> BOOL fSuccess; /* success indicator */ HWND hwndClient; /* client window */ char pszAppName[15]="";/* server application */ char pszTopicName[15]="";/* topic */ CONVCONTEXT Context; PDDESTRUCT pddeData; /* DDE structure */ case WM_CREATE: /* issue DDE initialize call */ fSuccess = WinDdeInitiate(hwndClient, pszAppName, pszTopicName, &Context); /* allocate shared memory for conversation data */ DosAllocSharedMem((PVOID)pddeData,"DDESHAREMEM", sizeof(DDESTRUCT) + 50, PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE | OBJ_GETTABLE);
Definition
#define INCL_WINDDE /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndClient; /* Client's window handle. */ PSZ pszAppName; /* Application name. */ PSZ pszTopicName; /* Topic name. */ PCONVCONTEXT pContext; /* Conversation context. */ BOOL rc; /* Success indicator. */ rc = WinDdeInitiate(hwndClient, pszAppName, pszTopicName, pContext);
Related Functions
Related Messages
- WM_DDE_INITIATE
- WM_DDE_INITIATEACK