ホーム › Networking.ActiveDirectory › IADsPropertyValue
IADsPropertyValue
COMIDispatch (デュアル)✅ IDispatch を実装(デュアルインターフェース)。HSP では
comobj 経由でメソッド名による遅延バインド呼び出しができます(vtableインデックス不要)。公式ドキュメント
IADsPropertyEntry オブジェクトの値を、定義済みのデータ型で表現するために使用します。
メソッド 25
vtbl = vtable インデックス(0始まり)。IDispatch 実装のため HSP ではメソッド名でも呼べます(上記)。低レベルの index 呼び出し用に vtbl も掲載。0〜2 は IUnknown。
vtbl 7 HRESULT Clear()
プロパティ値オブジェクトの現在の値をクリアします。
戻り値
このメソッドは、S_OK を含む標準的な HRESULT 戻り値をサポートします。詳細およびその他の戻り値については、ADSI Error Codes を参照してください。
解説(Remarks)
なし
例
次のコード例では、IADsPropertyValue::Clear を使用して、プロパティリストから "description" プロパティの値をクリアする方法を示します。
Dim propList As IADsPropertyList
Dim propEntry As IADsPropertyEntry
Dim propVal As IADsPropertyValue
On Error GoTo Cleanup
' Get the property list.
Set propList = GetObject("LDAP://dc01/DC=Fabrikam,DC=com")
propList.GetInfo
' Get a property entry. If you know the exact type of the property,
' replace ADSTYPE_UNKNOWN with that type.
Set propEntry = propList.GetPropertyItem("description", ADSTYPE_UNKNOWN)
' Clear all the values of the property entry.
For Each v In propEntry.Values
Set propVal = v
propVal.Clear
Next
propList.SetInfo
Cleanup:
If (Err.Number<>0) Then
MsgBox("An error has occurred. " & Err.Number)
End If
Set propList = Nothing
Set propEntry = Nothing
Set propVal = Nothing
次のコード例では、IADsPropertyValue::Clear を使用して、プロパティリストから "description" プロパティの値をクリアする方法を示します。
#include <activeds.h>
#include <stdio.h>
IADsPropertyList *pList = NULL;
IADsPropertyEntry *pEntry = NULL;
IADsPropertyValue *pVal = NULL;
IADs *pObj = NULL;
VARIANT var, varItem;
BSTR valStr;
IEnumVARIANT *pEnum = NULL;
LONG lstart, lend;
VariantInit(&var);
VariantInit(&varItem);
// Bind to the directory object.
HRESULT hr = ADsGetObject(L"LDAP://dc01/DC=Fabrikam,DC=com",
IID_IADsPropertyList,
(void**)&pList);
if(FAILED(hr)){goto Cleanup;}
// Initialize the property cache.
hr = pList->QueryInterface(IID_IADs,(void**)&pObj);
if(FAILED(hr)){goto Cleanup;}
pObj->GetInfo();
pObj->Release();
// Get a property entry.
hr = pList->GetPropertyItem(CComBSTR("description"), ADSTYPE_UNKNOWN, &var);
if(FAILED(hr)){goto Cleanup;}
pList->Release();
hr = V_DISPATCH(&var)->QueryInterface(IID_IADsPropertyEntry,
(void**)&pEntry);
if(FAILED(hr)){goto Cleanup;}
VariantClear(&var);
// Get the value array of the property entry.
hr = pEntry->get_Values(&var);
if(FAILED(hr)){goto Cleanup;}
SAFEARRAY *sa = V_ARRAY( &var );
// Get the lower and upper bound, iterate, and print the values.
hr = SafeArrayGetLBound( sa, 1, &lstart );
hr = SafeArrayGetUBound( sa, 1, &lend );
printf(" Property value(s) = ");
for ( long idx=lstart; idx < lend+1; idx++ ) {
hr = SafeArrayGetElement( sa, &idx, &varItem );
hr = V_DISPATCH(&varItem)->QueryInterface(IID_IADsPropertyValue,
(void**)&pVal);
VariantClear(&varItem);
hr = pVal->Clear();
if(FAILED(hr)){goto Cleanup;}
}
pList->SetInfo();
Cleanup:
if(pList)
pList->Release();
if(pEntry)
pEntry->Release();
if(pVal)
pVal->Release();
if(pObj)
pObj->Release();
if(pEnum)
pEnum->Release();
if(valStr)
SysFreeString(valStr);
VariantClear(&var);
VariantClear(&varItem);
| retval | INT* | out | 値のADSTYPE(データ型)を受け取る出力ポインタ。 |
| lnADsType | INT | in | 設定する値のADSTYPE(データ型)値。 |
| retval | LPWSTR* | out | 識別名(DN)形式の文字列値を受け取る出力ポインタ。 |
| bstrDNString | LPWSTR | in | 設定する識別名(DN)形式の文字列値。 |
| retval | LPWSTR* | out | 大文字小文字を区別する文字列値を受け取る出力ポインタ。 |
| bstrCaseExactString | LPWSTR | in | 設定する大文字小文字を区別する文字列値。 |
| retval | LPWSTR* | out | 大文字小文字を区別しない文字列値を受け取る出力ポインタ。 |
| bstrCaseIgnoreString | LPWSTR | in | 設定する大文字小文字を区別しない文字列値。 |
| retval | LPWSTR* | out | 印刷可能文字列値を受け取る出力ポインタ。 |
| bstrPrintableString | LPWSTR | in | 設定する印刷可能文字列値。 |
| retval | LPWSTR* | out | 数字文字列値を受け取る出力ポインタ。 |
| bstrNumericString | LPWSTR | in | 設定する数字文字列値。 |
| retval | INT* | out | ブール値(0/非0)を受け取る出力ポインタ。 |
| lnBoolean | INT | in | 設定するブール値(0=偽、非0=真)。 |
| retval | INT* | out | 整数値を受け取る出力ポインタ。 |
| lnInteger | INT | in | 設定する整数値。 |
| retval | VARIANT* | out | オクテット文字列(バイナリ)値を保持するVARIANTを受け取る出力ポインタ。 |
| vOctetString | VARIANT | in | 設定するオクテット文字列(バイナリ)値を保持するVARIANT。 |
| retval | IDispatch** | out | セキュリティ記述子を表すIDispatchを受け取る出力ポインタ。 |
| pSecurityDescriptor | IDispatch* | inoptional | 設定するセキュリティ記述子を表すIDispatchへのポインタ。 |
| retval | IDispatch** | out | 64ビット整数値を表すIDispatchを受け取る出力ポインタ。 |
| pLargeInteger | IDispatch* | inoptional | 設定する64ビット整数値を表すIDispatchへのポインタ。 |
| retval | DOUBLE* | out | UTC時刻をDOUBLE(日付シリアル値)で受け取る出力ポインタ。 |
| daUTCTime | DOUBLE | in | 設定するUTC時刻をDOUBLE(日付シリアル値)で指定する。 |
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
HSP用 COM定義
#usecom / #comfunc によるHSPのCOM呼び出し定義。数字は vtbl インデックス(0始まり)。クラスIDが無い場合 #usecom の末尾は "{}"、ある場合は "{CLSID}"。
出力引数:
#define global IID_IADsPropertyValue "{79FA9AD0-A97C-11D0-8534-00C04FD8D503}" #usecom global IADsPropertyValue IID_IADsPropertyValue "{}" #comfunc global IADsPropertyValue_Clear 7 #comfunc global IADsPropertyValue_get_ADsType 8 var #comfunc global IADsPropertyValue_put_ADsType 9 int #comfunc global IADsPropertyValue_get_DNString 10 var #comfunc global IADsPropertyValue_put_DNString 11 wstr #comfunc global IADsPropertyValue_get_CaseExactString 12 var #comfunc global IADsPropertyValue_put_CaseExactString 13 wstr #comfunc global IADsPropertyValue_get_CaseIgnoreString 14 var #comfunc global IADsPropertyValue_put_CaseIgnoreString 15 wstr #comfunc global IADsPropertyValue_get_PrintableString 16 var #comfunc global IADsPropertyValue_put_PrintableString 17 wstr #comfunc global IADsPropertyValue_get_NumericString 18 var #comfunc global IADsPropertyValue_put_NumericString 19 wstr #comfunc global IADsPropertyValue_get_Boolean 20 var #comfunc global IADsPropertyValue_put_Boolean 21 int #comfunc global IADsPropertyValue_get_Integer 22 var #comfunc global IADsPropertyValue_put_Integer 23 int #comfunc global IADsPropertyValue_get_OctetString 24 var #comfunc global IADsPropertyValue_put_OctetString 25 int #comfunc global IADsPropertyValue_get_SecurityDescriptor 26 sptr #comfunc global IADsPropertyValue_put_SecurityDescriptor 27 sptr #comfunc global IADsPropertyValue_get_LargeInteger 28 sptr #comfunc global IADsPropertyValue_put_LargeInteger 29 sptr #comfunc global IADsPropertyValue_get_UTCTime 30 var #comfunc global IADsPropertyValue_put_UTCTime 31 double ; ※数字は vtbl インデックス(0始まり)。0/1/2 は IUnknown(QueryInterface/AddRef/Release)。 ; ※このインターフェースは直接 CoCreateInstance するクラスIDが無いため "{}"(他メソッド/アクティベーションで取得)。 ; ※出力/バッファ引数は var(変数直渡し)。varptr 方式にも切替可。 ; ※ハンドル/void*等の不透明ポインタは IronHSP では intptr 指定が可能。 ; ※IDispatch 実装。HSP では comobj 経由でメソッド名による呼び出しも可能(vtbl 不要)。#define global IID_IADsPropertyValue "{79FA9AD0-A97C-11D0-8534-00C04FD8D503}" #usecom global IADsPropertyValue IID_IADsPropertyValue "{}" #comfunc global IADsPropertyValue_Clear 7 #comfunc global IADsPropertyValue_get_ADsType 8 sptr #comfunc global IADsPropertyValue_put_ADsType 9 int #comfunc global IADsPropertyValue_get_DNString 10 sptr #comfunc global IADsPropertyValue_put_DNString 11 wstr #comfunc global IADsPropertyValue_get_CaseExactString 12 sptr #comfunc global IADsPropertyValue_put_CaseExactString 13 wstr #comfunc global IADsPropertyValue_get_CaseIgnoreString 14 sptr #comfunc global IADsPropertyValue_put_CaseIgnoreString 15 wstr #comfunc global IADsPropertyValue_get_PrintableString 16 sptr #comfunc global IADsPropertyValue_put_PrintableString 17 wstr #comfunc global IADsPropertyValue_get_NumericString 18 sptr #comfunc global IADsPropertyValue_put_NumericString 19 wstr #comfunc global IADsPropertyValue_get_Boolean 20 sptr #comfunc global IADsPropertyValue_put_Boolean 21 int #comfunc global IADsPropertyValue_get_Integer 22 sptr #comfunc global IADsPropertyValue_put_Integer 23 int #comfunc global IADsPropertyValue_get_OctetString 24 sptr #comfunc global IADsPropertyValue_put_OctetString 25 int #comfunc global IADsPropertyValue_get_SecurityDescriptor 26 sptr #comfunc global IADsPropertyValue_put_SecurityDescriptor 27 sptr #comfunc global IADsPropertyValue_get_LargeInteger 28 sptr #comfunc global IADsPropertyValue_put_LargeInteger 29 sptr #comfunc global IADsPropertyValue_get_UTCTime 30 sptr #comfunc global IADsPropertyValue_put_UTCTime 31 double ; ※数字は vtbl インデックス(0始まり)。0/1/2 は IUnknown(QueryInterface/AddRef/Release)。 ; ※このインターフェースは直接 CoCreateInstance するクラスIDが無いため "{}"(他メソッド/アクティベーションで取得)。 ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。 ; ※ハンドル/void*等の不透明ポインタは IronHSP では intptr 指定が可能。 ; ※IDispatch 実装。HSP では comobj 経由でメソッド名による呼び出しも可能(vtbl 不要)。