IADsFileService 属性方法
IADsFileService 接口的属性方法获取或设置下表中所述的属性。 有关详细信息,请参阅 Interface 属性方法。
属性
-
描述
-
-
访问类型:读/写
-
脚本数据类型: BSTR
-
// C++ method syntax HRESULT get_Description( [out] BSTR* pbstrDescription ); HRESULT put_Description( [in] BSTR bstrDescription );
文件服务的说明。
-
-
MaxUserCount
-
-
访问类型:读/写
-
脚本数据类型: LONG
-
// C++ method syntax HRESULT get_MaxUserCount( [out] LONG* plMaxUserCount ); HRESULT put_MaxUserCount( [in] LONG lMaxUserCount );
服务中允许的最大用户数。
-
注解
必须通过文件服务访问计算机上的文件共享、会话和资源。
示例
下面的代码示例为文件服务的用户限制编写说明并检查。
Dim fs As IADsFileService
On Error GoTo Cleanup
' Bind to a file service object on "myComputer" in the local domain.
Set fs = GetObject("WinNT://myComputer/LanmanServer")
fs.Description = "WinNT file service."
n = fs.MaxUserCount
If n = -1 Then
MsgBox "No limit has been imposed on number of users allowed."
Else
MsgBox n & " users are allowed."
End If
Cleanup:
If (Err.Number<>0) Then
MsgBox("An error has occurred. " & Err.Number)
End If
Set fs = Nothing
下面的代码示例为文件服务对象编写说明并检查用户限制。
HRESULT CheckFileService()
{
IADsFileService *pFs = NULL;
LPWSTR adsPath = L"WinNT://myComputer/LanmanServer";
HRESULT hr = S_OK;
long count = 0;
hr = ADsGetObject(adsPath, IID_IADsFileService, (void**)&pFs)
if(FAILED(hr)) {goto Cleanup;}
hr = pFs->put_Description(CComBSTR("WinNT File Service"));
if(FAILED(hr)) {goto Cleanup;}
hr = pFs->SetInfo();
if(FAILED(hr)) {goto Cleanup;}
hr = pFs->get_MaxUserCount(&count);
if(FAILED(hr)) {goto Cleanup;}
if(count == -1) {
printf("No limit has been imposed on the number of users.\n");
}
else {
printf("Number of allowed users are %d\n",count);
}
Cleanup:
if(pFs) pFs->Release();
return S_OK;
}
要求
要求 | 值 |
---|---|
最低受支持的客户端 |
Windows Vista |
最低受支持的服务器 |
Windows Server 2008 |
标头 |
|
DLL |
|
IID |
IID_IADsFileService定义为 A89D1900-31CA-11CF-A98A-00AA006BC149 |