IPacket::WriteBool

更新:2007 年 11 月

向对象中写入一个布尔值。

HRESULT WriteBool([in] VARIANT_BOOL in_varBoolValue)

参数

  • in_varBoolValue
    要向数据包中写入的布尔值。

返回值

一个指示方法调用结果的 HRESULT 值。

示例

在此示例中,IDeviceAgentTransport::AcceptConnectionEx 创建 IDevicePacketStream 的一个实例。随后,此设备数据包流即用于将数据写入桌面上的 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);

托管等效项

IPacket.WriteBool

要求

DeviceAgentTransport.h

请参见

参考

IPacket