HCONV DdeConnect(idInst, hszService, hszTopic, pCC) | |||||
DWORD idInst; | /* instance identifier | */ | |||
HSZ hszService; | /* handle of service-name string | */ | |||
HSZ hszTopic; | /* handle of topic-name string | */ | |||
PCONVCONTEXT pCC; | /* address of structure with context data | */ |
The 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.
idInst
Specifies the application-instance identifier obtained by a previous call to the DdeInitialize function.
hszService
Identifies 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 NULL, a conversation will be established with any available server.
hszTopic
Identifies 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 the DdeCreateStringHandle function. If this parameter is NULL, a conversation on any topic supported by the selected server will be established.
pCC
Points 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.
The CONVCONTEXT structure has the following form:
#include <ddeml.h>
typedef struct tagCONVCONTEXT { /* cc */
UINT cb;
UINT wFlags;
UINT wCountryID;
int iCodePage;
DWORD dwLangID;
DWORD dwSecurity;
} CONVCONTEXT;
The return value is the handle of the established conversation if the function is successful. Otherwise, it is NULL.
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
The client application should not make assumptions regarding which server will be selected. If an instance-specific name is specified in the hszService parameter, a conversation will be established only with the specified instance. Instance-specific service names are passed to an application's dynamic data exchange 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).
DdeConnectList, DdeCreateStringHandle, DdeDisconnect, DdeDisconnectList, DdeInitialize