DdeQueryConvInfo

3.1

  #include <ddeml.h>    

  UINT DdeQueryConvInfo(hConv, idTransaction, lpConvInfo)    
  HCONV hConv; /* handle of conversation, */  
  DWORD idTransaction; /* transaction identifier */
  CONVINFO FAR* lpConvInfo; /* address of structure with conversation data */

The DdeQueryConvInfo function retrieves information about a dynamic data exchange (DDE) transaction and about the conversation in which the transaction takes place.

Parameters

hConv

Identifies the conversation.

idTransaction

Specifies the transaction. For asynchronous transactions, this parameter should be a transaction identifier returned by the DdeClientTransaction function. For synchronous transactions, this parameter should be QID_SYNC.

lpConvInfo

Points to the CONVINFO structure that will receive information about the transaction and conversation. The cb member of the CONVINFO structure must specify the length of the buffer allocated for the structure.

The CONVINFO structure has the following form:

#include <ddeml.h>

typedef struct tagCONVINFO { /* ci */
    DWORD   cb;
    DWORD   hUser;
    HCONV   hConvPartner;
    HSZ     hszSvcPartner;
    HSZ     hszServiceReq;
    HSZ     hszTopic;
    HSZ     hszItem;
    UINT    wFmt;
    UINT    wType;
    UINT    wStatus;
    UINT    wConvst;
    UINT    wLastError;
    HCONVLIST hConvList;
    CONVCONTEXT ConvCtxt;
} CONVINFO;

For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.

Return Value

The return value is the number of bytes copied into the CONVINFO structure, if the function is successful. Otherwise, it is zero.

Errors

Use the DdeGetLastError function to retrieve the error value, which may be one of the following:

DMLERR_DLL_NOT_INITIALIZED
DMLERR_NO_CONV_ESTABLISHED
DMLERR_NO_ERROR
DMLERR_UNFOUND_QUEUE_ID

Example

The following example fills a CONVINFO structure with information about a synchronous conversation and then obtains the names of the partner application and topic:

DWORD idInst;
HCONV hConv;
CONVINFO ci;
WORD wError;
char szSvcPartner[32];
char szTopic[32];
DWORD cchServ, cchTopic;

if (!DdeQueryConvInfo(hConv, QID_SYNC, &ci))
    wError = DdeGetLastError(idInst);



else {
    cchServ = DdeQueryString(idInst, ci.hszSvcPartner,
        (LPSTR) &szSvcPartner, sizeof(szSvcPartner),
        CP_WINANSI);
    cchTopic =DdeQueryString(idInst, ci.hszTopic,
        (LPSTR) &szTopic, sizeof(szTopic),
        CP_WINANSI);
}

See Also

DdeConnect, DdeConnectList, DdeQueryNextServer