IDeviceAgentTransport.AcknowledgeLaunch 方法
更新:2007 年 11 月
注册一个服务 ID 数组。如果开发计算机的服务 ID 处于该数组内,设备代理就可以接受来自该计算机的连接请求。
命名空间: Microsoft.SmartDevice.DeviceAgentTransport
程序集: Microsoft.SmartDevice.DeviceAgentTransport(在 Microsoft.SmartDevice.DeviceAgentTransport.dll 中)
语法
声明
Sub AcknowledgeLaunch ( _
in_ArraySize As UInteger, _
in_szServiceIds As String() _
)
用法
Dim instance As IDeviceAgentTransport
Dim in_ArraySize As UInteger
Dim in_szServiceIds As String()
instance.AcknowledgeLaunch(in_ArraySize, _
in_szServiceIds)
void AcknowledgeLaunch(
uint in_ArraySize,
string[] in_szServiceIds
)
void AcknowledgeLaunch(
[InAttribute] unsigned int in_ArraySize,
[InAttribute] array<String^>^ in_szServiceIds
)
function AcknowledgeLaunch(
in_ArraySize : uint,
in_szServiceIds : String[]
)
参数
in_ArraySize
类型:System.UInt32服务 ID 数组的大小。
in_szServiceIds
类型:array<System.String[]代理接受其连接的服务 ID。
异常
异常 | 条件 |
---|---|
COMException | HRESULT 信息:
|
ArgumentNullException | 如果将 in_szServiceIds 指定为 NULL。 |
备注
设备代理使用服务 ID 来识别它可以接受的连接请求。设备代理只能接受已用此方法注册其服务 ID 的连接。
服务 ID 不能包含空格,也不能是任何保留服务 ID(例如 ""、"Host"、"Transport"、"Shutdown" 或 "Accept")。为了确保唯一性,通常使用计算机生成的 GUID 作为服务 ID。若要生成 GUID,请在“工具”菜单中选择“创建 GUID”。
示例
Dim serviceids(0 To 0) As String
serviceids(0) = "2FAD740C-B5D3-4ad0-BE23-5682503584BF"
' Get an instance of Device Agent Transport
Dim transport As IDeviceAgentTransport = _
DeviceAgentTransportFactory.GetAgentTransport()
' Register the callback object with the Device Agent Transport.
Dim shutdownCallback As New ShutdownCallback()
transport.RegisterShutdownCallback(shutdownCallback, shutdownCallback)
' Let the desktop application know that this device agent was deployed successfully
' and will handle the supplied list of service IDs.
transport.AcknowledgeLaunch(Convert.ToUInt32(serviceids.Length), serviceids)
' Open a communcation stream with desktop application on the service.
Dim packetStream As IDevicePacketStream
transport.AcceptConnectionEx(serviceids(0), packetStream)
string[] serviceids = { "2FAD740C-B5D3-4ad0-BE23-5682503584BF" };
// Get an instance of Device Agent Transport
IDeviceAgentTransport transport = DeviceAgentTransportFactory.GetAgentTransport();
// Register the callback object with the Device Agent Transport.
ShutdownCallback shutdownCallback = new ShutdownCallback();
transport.RegisterShutdownCallback(shutdownCallback, shutdownCallback);
// Let the desktop application know that this device agent was deployed successfully
// and will handle the supplied list of service IDs.
transport.AcknowledgeLaunch(Convert.ToUInt32(serviceids.Length), serviceids);
// Open a communcation stream with desktop application on the service.
IDevicePacketStream packetStream;
transport.AcceptConnectionEx(serviceids[0], out packetStream);
权限
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。