DdeReconnect

3.1

  #include <ddeml.h>    

  HCONV DdeReconnect(hConv)    
  HCONV hConv; /* handle of conversation to reestablish */

The DdeReconnect function allows a client Dynamic Data Exchange Management Library (DDEML) application to attempt to reestablish a conversation with a service that has terminated a conversation with the client. When the conversation is reestablished, the DDEML attempts to reestablish any preexisting advise loops.

Parameters

hConv

Identifies the conversation to be reestablished. A client must have obtained the conversation handle by a previous call to the DdeConnect function.

Return Value

The return value is the handle of the reestablished conversation if the function is successful. The return value is NULL if the function fails.

Errors

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

DMLERR_DLL_NOT_INITIALIZED
DMLERR_INVALIDPARAMETER
DMLERR_NO_CONV_ESTABLISHED
DMLERR_NO_ERROR

Example

The following example shows the context within which an application should call the DdeReconnect function:

HDDEDATA EXPENTRY DdeCallback(wType, wFmt, hConv, hsz1,
    hsz2, hData, dwData1, dwData2)
WORD wType;       /* transaction type                 */
WORD wFmt;        /* clipboard format                 */
HCONV hConv;      /* handle of the conversation       */
HSZ hsz1;         /* handle of a string               */
HSZ hsz2;         /* handle of a string               */
HDDEDATA hData;   /* handle of a global memory object */
DWORD dwData1;    /* transaction-specific data        */
DWORD dwData2;    /* transaction-specific data        */
{
    BOOL fAutoReconnect;

    switch (wType) {
        case XTYP_DISCONNECT:
            if (fAutoReconnect) {
                DdeReconnect(hConv); /* attempt to reconnect */
            }
            return 0;

        .
        . /* Process other transactions. */
        .
    }
}

See Also

DdeConnect, DdeDisconnect