大网数据广告活动
域与目录服务

Interface Property Methods

· 52CE 我爱测

Many ADSI interfaces are designed to support Automation and thus are dual interfaces in that they support client access through both IUnknown and IDispatch interfaces.

Many ADSI interfaces are designed to support Automation and thus are dual interfaces in that they support client access through both IUnknown and IDispatch interfaces. Non-Automation clients, such as those written in C/C++, resolve method invocation directly, using the IUnknown::QueryInterface method, and call the method directly. Automation clients, also known as name-bound clients, such as those written in Visual Basic, or Visual Basic Scripting Edition (VBScript), must resolve method invocation indirectly using the dispinterface method.

An ADSI interface supporting Automation defines property methods for retrieving and modifying properties of an object implementing the interface. The property methods have names that have get_ and put_ prepended to the appropriate property names, for example, get_User and put_Name.

Each get_ method takes a single parameter as output. This parameter is a method-allocated address of a variable of the property data type. On return, this variable assumes the current value of the requested property. The caller must release the allocated memory of the variable when the property is no longer required.

Each put_ method takes a single parameter as input for the data type of the corresponding property. The parameter holds a new value of the property.

The following code example shows the invocation of the property methods that follow the usual procedure to call the member function of an object.

IADs *pADs;
BSTR bstrName;
pADs->get_Name(&bstrName);

The following code example shows the invocation of the property methods in automation clients, which can be somewhat different. For example, Visual Basic uses dot notation.

Dim Obj As IADs
Dim objName As String
objName = Obj.Name

All parameters and return types must be of those that the VARIANT data type defines. All methods on a dual interface return an HRESULT value to indicate success or failure.

For more information about getting and setting properties on ADSI objects, see Property Cache.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。