DdeNameService function (ddeml.h)

Registers or unregisters the service names a Dynamic Data Exchange (DDE) server supports. This function causes the system to send XTYP_REGISTER or XTYP_UNREGISTER transactions to other running Dynamic Data Exchange Management Library (DDEML) client applications.

Syntax

HDDEDATA DdeNameService(
  [in]           DWORD idInst,
  [in, optional] HSZ   hsz1,
  [in, optional] HSZ   hsz2,
  [in]           UINT  afCmd
);

Parameters

[in] idInst

Type: DWORD

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

[in, optional] hsz1

Type: HSZ

A handle to the string that specifies the service name the server is registering or unregistering. An application that is unregistering all of its service names should set this parameter to 0L.

[in, optional] hsz2

Type: HSZ

Reserved; should be set to 0L.

[in] afCmd

Type: UINT

The service name options. This parameter can be one of the following values.

Value Meaning
DNS_REGISTER
0x0001
Registers the error code service name.
DNS_UNREGISTER
0x0002
Unregisters the error code service name. If the hsz1 parameter is 0L, all service names registered by the server will be unregistered.
DNS_FILTERON
0x0004
Turns on service name initiation filtering. The filter prevents a server from receiving XTYP_CONNECT transactions for service names it has not registered. This is the default setting for this filter.

If a server application does not register any service names, the application cannot receive XTYP_WILDCONNECT transactions.

DNS_FILTEROFF
0x0008
Turns off service name initiation filtering. If this flag is specified, the server receives an XTYP_CONNECT transaction whenever another DDE application calls the DdeConnect function, regardless of the service name.

Return value

Type: HDDEDATA

If the function succeeds, it returns a nonzero value. That value is not a true HDDEDATA value, merely a Boolean indicator of success. The function is typed HDDEDATA to allow for possible future expansion of the function and a more sophisticated return value.

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:

Remarks

The service name identified by the hsz1 parameter should be a base name (that is, the name should contain no instance-specific information). The system generates an instance-specific name and sends it along with the base name during the XTYP_REGISTER and XTYP_UNREGISTER transactions. The receiving applications can then connect to the specific application instance.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header ddeml.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

Conceptual

DdeConnect

DdeConnectList

DdeInitialize

Dynamic Data Exchange Management Library

Reference

XTYP_REGISTER

XTYP_UNREGISTER