Compartilhar via


INetCfgComponentPropertyUi::SetContext method

The SetContext method directs the notify object of the network component to display the component's properties in the context of a particular binding path or adapter.

Syntax

HRESULT SetContext(
  [in] IUnknown *pUnk
);

Parameters

  • pUnk [in]
    Pointer to the IUnknown interface. SetContext retrieves from IUnknown the interface of a particular binding path or network adapter in which to display properties for the network component that owns the notify object. When the network configuration subsystem releases the interface, it calls SetContext and passes a NULL value.

Return value

Returns zero (S_OK) if successful; otherwise, returns NETCFG_* codes that are defined in Netcfgx.h.

Remarks

The network configuration subsystem can only call SetContext if its call to the notify object's INetCfgComponentPropertyUi::QueryPropertyUi method returned S_OK.

SetContext is called before the notify object's INetCfgComponentPropertyUi::MergePropPages method is called to inform the notify object of the specific context in which to create and merge custom property pages.

If the network configuration subsystem calls SetContext, it calls SetContext once to complete each of the following tasks:

  • Provide the notify object with the information it requires to identify either a binding path or an adapter. In this case, SetContext is called and the context that was previously passed to QueryPropertyUi is passed. The notify object subsequently displays properties for the network component that owns the object through either the identified binding path or adapter.

  • Release the context that the network configuration subsystem previously provided. In this case, SetContext is called and NULL is passed.

SetContext calls the QueryInterface method on the supplied IUnknown interface to determine if the network configuration subsystem supplied an interface for a specific object.

For example, the network configuration subsystem can supply the INetLanConnectionUiInfo interface when it calls SetContext. SetContext can use the GetDeviceGuid method of INetLanConnectionUiInfo to retrieve the GUID of a LAN device. The notify object can subsequently display properties for its network component in the context of this LAN device. For example, the notify object for the TCP/IP protocol can display an IP address that is associated with a particular LAN adapter in the context of that adapter. Doing so enables users to specify an IP address for that adapter.

The notify object can also use the retrieved LAN-device GUID to open a registry key under the registry key for the network component that owns the notify object. The notify object can use this newly opened key to store configuration information that is specific to the LAN device.

Requirements

Target platform

Desktop

Header

Netcfgn.h (include Netcfgn.h)

See also

INetCfgComponentPropertyUi::MergePropPages

INetCfgComponentPropertyUi::QueryPropertyUi

INetLanConnectionUiInfo

INetLanConnectionUiInfo::GetDeviceGuid

 

 

Send comments about this topic to Microsoft