如何使字节CComSafeArray在COM对象中使用 [英] How to make a byte CComSafeArray to use in a COM object

查看:81
本文介绍了如何使字节CComSafeArray在COM对象中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!

我需要采用不同类型的数据,例如:

Hi there!

I need to take differents types of data, like:

int n = 12; //plus
short int n1 = 255; //plus
unsigned char b = 4; //plus
unsigned short w = 1600;
std::string str = "SR_protocol";



将所有togheter放入CComSafeArray< BYTE>中,然后将其转换为发送到COM对象(OPC)中,例如:



put all togheter in a CComSafeArray<BYTE>, and convert it to send in a COM object (OPC), like:

CComSafeArray<BYTE> saByteArray;
CComVariant varArrayWrapper(saByteArray);
VARIANT *vSendMSG = NULL;
varArrayWrapper.Detach(vSendMSG);



但是我不知道该怎么做..请帮我



But I don''t know how to do it.. help me please

推荐答案

将其格式化为XML并将整个结构作为字符串发送?
format it as XML and send the whole struct as a string ?


这篇关于如何使字节CComSafeArray在COM对象中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆