描述
IWbemStatusCodeText.GetFacilityCodeText方法返回发生错误的子系统的名称,例如“Windows”,“WBEM”,“SSPI”或“RPC”。
C++ 语法
HRESULT GetFacilityCodeText( [in] HRESULT hRes, [in] LCID LocaleId, [in] long lFlags, [out] BSTR *MessageText ); |
PowerBASIC 语法
METHOD GetFacilityCodeText ( _ BYVAL hRes AS LONG, _ BYVAL LocaleId AS DWORD, _ BYVAL lFlags AS LONG, _ BYREF MessageText AS WSTRING _ ) AS LONG |
参数
hRes
处理您想要描述的错误代码。
LocaleId
保留。该参数必须为0(零)。
lFlags
保留。该参数必须为0(零)。
MessageText
指向包含错误代码描述文本的字符串。
返回值
如果成功,此方法返回WBEM_S_NO_ERROR。
示例代码
以下示例说明如何实现GetFacilityCodeText.
IWbemStatusCodeText * pStatus = NULL;
SCODE sc = CoCreateInstance(CLSID_WbemStatusCodeText,
0, CLSCTX_INPROC_SERVER,
IID_IWbemStatusCodeText,
(LPVOID *) &pStatus);
if(sc == S_OK)
{
BSTR bstr = 0;
// The m_hres is an HRESULT variable that has already
// been declared and initialized.
sc = pStatus->GetErrorCodeText(m_hres, 0, 0, &bstr);
if(sc == S_OK)
{
// ...display string here.
SysFreeString(bstr);
bstr = 0;
}
sc = pStatus->GetFacilityCodeText(m_hres, 0, 0, &bstr);
if(sc == S_OK)
{
// to do, display this.
SysFreeString(bstr);
bstr = 0;
}
pStatus->Release();
}
// clean up.
pStatus->Release();
备注
要启用GetFacilityCodeText方法返回子系统名称,调用者必须释放MessageText参数中的指针。
要求
客户 |
需要Windows Vista,Windows XP,Windows 2000 Professional,Windows NT Workstation 4.0 SP4及更高版本,Windows Me,Windows 98或Windows 95。 |
服务器 |
需要Windows Server 2008,Windows Server 2003,Windows 2000 Server或Windows NT Server 4.0 SP4及更高版本。 |
头 |
在Wbemcli.inc中声明 |
DLL |
需要Wmiutils.dll。 |