IDeviceAgentTransport::AcknowledgeLaunch
更新:2007 年 11 月
注册一个服务 ID 数组。如果开发计算机的服务 ID 处于该数组内,设备代理就可以接受来自该计算机的连接请求。
HRESULT AcknowledgeLaunch([in] DWORD in_ArraySize, [size_is][in] LPCOLESTR in_szServiceIds[])
参数
in_ArraySize
服务 ID 数组的大小。in_szServiceIds
代理接受其连接的服务 ID。
返回值
一个指示方法调用结果的 HRESULT 值。
备注
设备代理使用服务 ID 来识别它可以接受的连接请求。设备代理只能接受已用此方法注册其服务 ID 的连接。
服务 ID 不能包含空格,也不能是任何保留服务 ID(例如 ""、"Host"、"Transport"、"Shutdown" 或 "Accept")。为了确保唯一性,通常使用计算机生成的 GUID 作为服务 ID。若要生成 GUID,请在“工具”菜单中选择“创建 GUID”。
示例
此示例将调用 AcknowledgeLaunch,以通知台式机上的 RemoteAgent 对象:设备代理正在设备上运行。有关完整的示例,请参见IDeviceAgentTransport。
// Let the desktop application know that this remote agent was deployed successfully
// and that this remote agent will handle the supplied list of services.
LPCOLESTR szServiceIds[] = {L"F85E57BA-5AE9-4FF7-8433-6AB7D991D033"};
pTransport->AcknowledgeLaunch(1, szServiceIds);
// Open a communcation stream with desktop application on the service.
IDevicePacketStream *pStream = NULL;
pTransport->AcceptConnectionEx(szServiceIds[0], &pStream);
// Get an instance of IPacket
GetNewPacketFunc f2 = (GetNewPacketFunc) :: GetProcAddress(hmod, L"GetNewPacket");
IPacket *pPacket = NULL;
f2(&pPacket);
// Write a message and sent the packet.
pPacket->WriteBool(true);
pPacket->WriteByte(0xff);
pPacket->WriteChar('c');
pPacket->WriteInt32(1024);
pPacket->WriteString(L"Hello Desktop Computer");
pStream->Write(pPacket);
托管等效项
IDeviceAgentTransport.AcknowledgeLaunch
要求
DeviceAgentTransport.h