IDeviceAgentTransport.RegisterShutdownCallback 方法

更新:2007 年 11 月

注册回调以在代理关闭前收到通知。

命名空间:  Microsoft.SmartDevice.DeviceAgentTransport
程序集:  Microsoft.SmartDevice.DeviceAgentTransport(在 Microsoft.SmartDevice.DeviceAgentTransport.dll 中)

语法

声明
Sub RegisterShutdownCallback ( _
    in_pCallback As IAgentTransportShutdownCallback, _
    in_pUnknown As Object _
)
用法
Dim instance As IDeviceAgentTransport
Dim in_pCallback As IAgentTransportShutdownCallback
Dim in_pUnknown As Object

instance.RegisterShutdownCallback(in_pCallback, _
    in_pUnknown)
void RegisterShutdownCallback(
    IAgentTransportShutdownCallback in_pCallback,
    Object in_pUnknown
)
void RegisterShutdownCallback(
    [InAttribute] IAgentTransportShutdownCallback^ in_pCallback, 
    [InAttribute] Object^ in_pUnknown
)
function RegisterShutdownCallback(
    in_pCallback : IAgentTransportShutdownCallback, 
    in_pUnknown : Object
)

参数

  • in_pUnknown
    类型:System.Object

    要以参数形式传递给回调例程的接口 Cookie。

异常

异常 条件
COMException

HRESULT 信息:

  • E_INVALIDARG | 参数无效

  • E_FAIL | 指示任何其他失败情况

备注

当台式机显式关闭或通过运行 clientshutdown.exe 关闭 conmanclient2.exe 时,都将关闭代理。设备代理可以请求接收关闭通知,以便正常执行清理和退出操作。为了接收关闭通知,设备代理必须定义实现 IAgentTransportShutdownCallback 的类并使用此方法注册该类。

示例

' Register the callback object with the Device Agent Transport.
Dim shutdownCallback As New ShutdownCallback()
transport.RegisterShutdownCallback(shutdownCallback, shutdownCallback)
// Register the callback object with the Device Agent Transport.
ShutdownCallback shutdownCallback = new ShutdownCallback();
transport.RegisterShutdownCallback(shutdownCallback, shutdownCallback);

权限

另请参见

参考

IDeviceAgentTransport 接口

IDeviceAgentTransport 成员

Microsoft.SmartDevice.DeviceAgentTransport 命名空间