如何将8209数组对象变量转换为VT_VARIANT [英] How to convert 8209 array object variant to VT_VARIANT

查看:213
本文介绍了如何将8209数组对象变量转换为VT_VARIANT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调用一个COM对象方法,该方法在我的PHP代码中返回类型为8209的数组变量对象.

I am calling a COM object method that returns an array variant object of type 8209 in my PHP code.

$com_VArray = $com_Object->objectMethod; //Is a 8209 variant object

我最终希望将转换后的VT_VARIANT对象作为另一个COM对象方法的值传递,该方法要求其输入为VT_VARIANT [12].

I want in the end to pass the converted VT_VARIANT object as a value for another COM object method which requires its input to be VT_VARIANT[12].

我通过发出以下命令将$ com_VArray转换为VT_VARIANT对象变量类型

I am converting $com_VArray to a VT_VARIANT object variant type by issuing the following

$obj_VT_VARIANT = variant_cast($com_VArray, VT_VARIANT);

但随后出现以下错误

致命错误:消息变量类型转换失败:类型不匹配"的未捕获异常"com_exception".在C:\ xampp \ htdocs \ waterCompany \ reservoir.php:110堆栈跟踪#0 C:\ xampp \ htdocs \ waterCompany \ reservoir.php(110):variant_cast(Object(variant),12)#1 {main}抛出在第110行的C:\ xampp \ htdocs \ waterCompany \ reservoir.php中.

Fatal error: Uncaught exception 'com_exception' with message 'Variant type conversion failed: Type mismatch.' in C:\xampp\htdocs\waterCompany\reservoir.php:110 Stack trace #0 C:\xampp\htdocs\waterCompany\reservoir.php(110): variant_cast(Object(variant),12)#1{main} thrown in C:\xampp\htdocs\waterCompany\reservoir.php on line 110.

我已经在此处的variant_cast中做了更多的阅读 http://php.net/manual/en/function.variant-set-type.php ,但是我并没有取得太大进展.

I have done some more reading on variant_cast here http://php.net/manual/en/function.variant-set-type.php but I have not made much significant headways.

我正在使用PHP 5.5.11.

I am using PHP 5.5.11.

推荐答案

8209是0x2011,表示VT_UI1元素数组.

8209 is 0x2011 that signals an array of VT_UI1 elements.

当要转换它时,需要创建一个Variants数组并将旧类型的每个元素复制到其中.复制内容时,可以将每个VT_UI1元素转换为VT_VARIANT类型.

When you want to convert it, you need to create an array of Variants and copy each element of the old type into it. When you copy the contents you can cast each VT_UI1 element into an VT_VARIANT type.

现在也不允许转换数组.只需尝试学习变量的基础

It is not and never allowed to cast arrays. Just try to learn the basisc of VARIANTs

这篇关于如何将8209数组对象变量转换为VT_VARIANT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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