Windows Dev Center

DdeConnect function

Establishes a conversation with a server application that supports the specified service name and topic name pair. If more than one such server exists, the system selects only one.

Syntax


HCONV WINAPI DdeConnect(
  _In_     DWORD        idInst,
  _In_     HSZ          hszService,
  _In_     HSZ          hszTopic,
  _In_opt_ PCONVCONTEXT pCC
);

Parameters

idInst [in]

Type: DWORD

The application instance identifier obtained by a previous call to the DdeInitialize function.

hszService [in]

Type: HSZ

A handle to the string that specifies the service name of the server application with which a conversation is to be established. This handle must have been created by a previous call to the DdeCreateStringHandle function. If this parameter is 0L, a conversation is established with any available server.

hszTopic [in]

Type: HSZ

A handle to the string that specifies the name of the topic on which a conversation is to be established. This handle must have been created by a previous call to DdeCreateStringHandle. If this parameter is 0L, a conversation on any topic supported by the selected server is established.

pCC [in, optional]

Type: PCONVCONTEXT

A pointer to the CONVCONTEXT structure that contains conversation context information. If this parameter is NULL, the server receives the default CONVCONTEXT structure during the XTYP_CONNECT or XTYP_WILDCONNECT transaction.

Return value

Type: HCONV

If the function succeeds, the return value is the handle to the established conversation.

If the function fails, the return value is 0L.

The DdeGetLastError function can be used to get the error code, which can be one of the following values:

DMLERR_DLL_NOT_INITIALIZED
DMLERR_INVALIDPARAMETER
DMLERR_NO_CONV_ESTABLISHED
DMLERR_NO_ERROR

Remarks

The client application cannot make assumptions regarding the server selected. If an instance-specific name is specified in the hszService parameter, a conversation is established with only the specified instance. Instance-specific service names are passed to an application's Dynamic Data Exchange (DDE) callback function during the XTYP_REGISTER and XTYP_UNREGISTER transactions.

All members of the default CONVCONTEXT structure are set to zero except cb, which specifies the size of the structure, and iCodePage, which specifies CP_WINANSI (the default code page) or CP_WINUNICODE, depending on whether the ANSI or Unicode version of the DdeInitialize function was called by the client application.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Ddeml.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
CONVCONTEXT
DdeConnectList
DdeCreateStringHandle
DdeDisconnect
DdeDisconnectList
DdeInitialize
XTYP_REGISTER
XTYP_UNREGISTER
Conceptual
Dynamic Data Exchange Management Library

 

 

Community Additions

ADD
Show:
© 2015 Microsoft