Jump to content

WinDdeInitiate: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
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.  
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==
==Syntax==
Line 5: Line 5:


==Parameters==
==Parameters==
; hwndClient (HWND) - input
;hwndClient (HWND) - input:Client's window handle.
:Client's window handle.  
;pszAppName (PSZ) - input:Application name.
 
; 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.
: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.  
:Application names may not contain slashes or backslashes.
 
;pszTopicName (PSZ) - input: Topic name.
; pszTopicName (PSZ) - input
: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.
: Topic name.
;pContext (PCONVCONTEXT) - input:Conversation context.
: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==
==Returns==
; rc (BOOL) - returns
;rc (BOOL) - returns: Success indicator.
: Success indicator.
:;TRUE:Successful completion. The WM_DDE_INITIATE message is successfully sent to all appropriate windows.
:;TRUE
:;FALSE:Error occurred.
:: Successful completion. The WM_DDE_INITIATE message is successfully sent to all appropriate windows.  
:;FALSE
::Error occurred.


==Remarks==
==Remarks==
Line 33: Line 23:
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).
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.  
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==
==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.  
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.
<pre>
<pre>
#define INCL_WINDDE            /* Window DDE Functions        */
#define INCL_WINDDE            /* Window DDE Functions        */
Line 72: Line 62:
BOOL            rc;            /*  Success indicator. */
BOOL            rc;            /*  Success indicator. */


rc = WinDdeInitiate(hwndClient, pszAppName,
rc = WinDdeInitiate(hwndClient, pszAppName, pszTopicName, pContext);
      pszTopicName, pContext);
</pre>
</pre>


Line 82: Line 71:
==Related Messages==
==Related Messages==
* WM_DDE_INITIATE
* WM_DDE_INITIATE
* WM_DDE_INITIATEACK  
* WM_DDE_INITIATEACK


[[Category:Win]]
[[Category:Win]]

Latest revision as of 14:58, 16 May 2023

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