IPacket::WriteInt32
更新:2007 年 11 月
向对象中写入一个整数。
HRESULT WriteInt32([in] INT32 in_int32Value)
参数
- in_int32Value
要向数据包中写入的整数。
返回值
一个指示方法调用结果的 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);
托管等效项
要求
DeviceAgentTransport.h