IADsPathname::GetEscapedElement 方法 (iads.h)

IADsPathname::GetEscapedElement 方法用于转义输入路径中的特殊字符。

语法

HRESULT GetEscapedElement(
  [in]  long lnReserved,
  [in]  BSTR bstrInStr,
  [out] BSTR *pbstrOutStr
);

参数

[in] lnReserved

保留供将来使用。

[in] bstrInStr

输入字符串。

[out] pbstrOutStr

输出字符串。

返回值

此方法支持标准返回值以及以下值:

有关详细信息和其他返回值,请参阅 ADSI 错误代码

注解

此方法用于处理在未转义字符串中包含特殊字符的路径,作为用户界面的输入。 输入字符串必须是路径的名称/值对) (单个元素;即“CN=Smith,Jeff”。

示例

下面的 Visual Basic 代码示例显示了 IADsPathname::GetEscapedElement 生成的效果。 执行此代码后,rdn 将包含“cn=smith,jeff”。

Dim x As New Pathname
 
rdn = x.GetEscapedElement(0, "cn=smith,jeff")

以下 VBScript 代码示例显示了 IADsPathname::GetEscapedElement 产生的效果。 执行此代码后,rdn 将包含“cn=smith,jeff”。

Dim x 
Set x = CreateObject("Pathname")
rdn = x.GetEscapedElement(0, "cn=smith,jeff")

以下 C++ 代码示例演示 IADsPathname::GetEscapedElement 生成的效果。 执行此代码后,rdn 将包含“cn=smith,jeff”。

LPWSTR adsPath=L"LDAP://server/cn=jeffsmith,dc=Fabrikam,dc=com";
 
IADsPathname *pPath = GetPathnameObject(adsPath);
BSTR rdn;
HRESULT hr = pPath->GetEscapedElement(0,CComBSTR("cn=smith,jeff")
                                      ,&rdn);
 
pPath->Release();

要求

   
最低受支持的客户端 Windows Vista
最低受支持的服务器 Windows Server 2008
目标平台 Windows
标头 iads.h
DLL Activeds.dll

另请参阅

ADSI 错误代码

IADsPathname