勇芳软件工作室.汉化:  Windows Management Instrumentation > COM API for WMI > Interfaces > IWbemServices >

QueryObjectSink Method

Previous pageReturn to chapter overviewNext page

描述

 

IWbemServices.QueryObjectSink方法允许调用者获取由Windows Management导出的通知处理程序。这允许调用者将通知和事件直接写入Windows管理。调用者只能将外部事件写入Windows Management。有关详细信息,请参阅确定要接收的事件类型.

 

C++ 语法

 

HRESULT QueryObjectSink(

[in]   LONG lFlags,

[out]  IWbemObjectSink **ppResponseHandler

);

 

PowerBASIC 语法

 

METHOD QueryObjectSink ( _

BYVAL lFlags AS LONG, _

BYREF ppResponseHandler AS IWbemObjectSink _

) AS LONG

 

参数

 

lFlags

 

保留。该参数必须为0。

 

ppResponseHandler

 

接收到通知处理程序的接口指针。当有错误时,这被设置为指向NULL。返回的指针具有正的引用计数,当不再需要时,调用者必须在指针上调用IWbemServices.Release.如果没有通知处理程序可用,则可以返回NULL值。这不是错误。

 

注意当传递给此方法时,ppResponseHandler参数的值不能为NULL。

 

返回值

 

此方法返回一个HRESULT,指示方法调用的状态。下表列出了HRESULT中包含的值。

 

如果网络问题导致您失去与Windows Management的远程连接,也可能会返回COM特定的错误代码。

 

退货代码

描述

WBEM_E_ACCESS_DENIED

来电者没有向Windows管理提供通知的权限。

WBEM_E_FAILED

这是一个未指定的错误。

WBEM_E_INVALID_PARAMETER

指定了无效参数。

WBEM_E_OUT_OF_MEMORY

没有足够的内存来完成操作。

WBEM_E_SHUTTING_DOWN

Windows管理服务可能已停止并重新启动。需要新的电话ConnectServer.

WBEM_E_TRANSPORT_FAILURE

这表示当前进程和Windows Management之间的远程过程调用(RPC)链接失败。

WBEM_S_NO_ERROR

通话成功。

 

Windows Server 2003和Windows XP SP1: 默认情况下,仅允许管理员使用QueryObjectSink触发事件。将权限扩展到其他用户需要授予他们WBEM_FULL_WRITE权限。

 

要求

 

客户

需要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

需要Fastprox.dll。

需要Esscli.dll。

需要Framedyn.dll。

需要Ntevt.dll。

需要Stdprov.dll。

需要Viewprov.dll。

需要Wbemcomn.dll。

需要Wbemcore.dll。

需要Wbemess.dll。

需要Wbemsvc.dll。

需要Wmipicmp.dll。

需要Wmidcprv.dll。

需要Wmipjobj.dll。

需要Wmiprvsd.dll。