统计 |
blog名称:人在旅途 日志总数:175 评论数量:505 留言数量:13 访问次数:1671248 建立时间:2005年12月7日 |
生命是过客,人在旅途。奶奶是信基督教的,没啥文化,却养育了四子二女,还带过九个孙辈。老人家对生命的看法就是“人都是客人,迟早要回去的。”就以《人在旅途》来纪念她。

« | September 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | | | | | |
|
公告 |
本人上传的源程序中可能引用或使用了第三方的库或程序,也可能是修改了第三方的例程甚至是源程序.所以本人上传的源程序禁止在以单纯学习为目的的任何以外场合使用,不然如果引起任何版权问题,本人不负任何责任. | |

|
本站首页 管理页面 写新日志 退出
调整中...
[微软技术开发]COM method and property arguments Test |
人在旅途 发表于 2006/1/22 8:31:05 | This project is here for me to study and test many problems which I met in other COM project and can't be solved, eg: Object,SAFEARRAY created in the server.
Step1: Create a new ATL COM named ComTestResult1: Dim x As TESTCOMLib.ComTest Set x = New TESTCOMLib.ComTest x.GetVar o : When the o is Passed into the ComTest as a variant* pRet, the pRet->vt == VT_EMPTY, and at this time you can return this variant as pRet->vt = VT_DISPATCH.Result2:Dim x As TESTCOMLib.ComTest Set x = New TESTCOMLib.ComTest dim o as object x.GetVar o : When the o is Passed into the ComTest as a variant* pRet, the pRet->vt == VT_DISPATCH|VT_BYREF. And at this time, you can return like this in VC++: this->AddRef(); CComTest* pX = this; *(pRet->ppdispVal) = (IDispatch*)pX;
Step2: Create a method which will return safearray which is created in the server. In the client: Dim x As TESTCOMLib.ComTest Set x = New TESTCOMLib.ComTest dim o x.GetVar o
in the server: pRet->vt = VT_ARRAY|VT_UI1; SAFEARRAYBOUND rgsabound[1]; rgsabound[0].lLbound = 0; rgsabound[0].cElements = 20; pRet->parray = SafeArrayCreate(VT_UI1, 1, rgsabound); NOTES: It seems that this will also function during the property situation. But,there is a strange and important ruler, that is you must: Dim y(2) As Byte y(0) = 1 y(1) = 3 y(2) = 5 x = y Pane1.Values = (x)'not Pane1.Values = xStep3: If you pass a NULL parameter to a COM in VB, then in VC you will receive a variant with the vt as VT_NULL.
|
阅读全文(1933) | 回复(0) | 编辑 | 精华 |
|