更新:2007 年 11 月
为设备端代理提供执行清理和退出的机会。
HRESULT Shutdown([in] IUnknown *in_pUnknown)
参数
- in_pUnknown
IUnknown 的接口 Cookie
返回值
一个指示方法调用结果的 HRESULT 值。
S_OK | 此 API 调用已成功。
E_FAIL | 返回指示任何其他失败情况的值。
备注
若要注册该回调对象,请使用 IDeviceAgentTransport::RegisterShutdownCallback。
示例
下面的示例定义 IAgentTransportShutdownCallback 的一个自定义实现。有关完整的示例,请参见IDeviceAgentTransport。
// Custom implementation of IAgentTransportShutdownCallback
class MyShutdownCallback: public IAgentTransportShutdownCallback
{
private:
long ref;
public:
HRESULT STDMETHODCALLTYPE Shutdown(IUnknown *in_pUnknown)
{
// Add your cleanup code here
MessageBox(NULL,_T("conmanclient2 exited"),_T("conmanclient exited"),0);
return 0;
}
// Must implement members from IUnknown
HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject)
{
return 0;
}
ULONG STDMETHODCALLTYPE AddRef( void)
{
return InterlockedIncrement(&ref);
}
ULONG STDMETHODCALLTYPE Release( void)
{
if(InterlockedDecrement(&ref) == 0)
{
delete this;
return 0;
}
return ref;
}
};
托管等效项
IAgentTransportShutdownCallback.Shutdown
要求
DeviceAgentTransport.h