HRESULT TestArray([in] SAFEARRAY lOp1,[out,retval] SAFEARRAY * plResult);错在哪里?

sorry2000 2002-04-20 06:25:57
在idl文件中加了这一句之后编译就不能通过!
编译信息:
error MIDL2139 : type of the parameter cannot derive from void or void * : [ Type 'PVOID' ( Parameter 'lOp1' ) ]
error MIDL2105 : pointee / array does not derive any size : [ Field 'rgsabound' of Struct 'tagSAFEARRAY' ( Parameter 'lOp1' ) ]
warning MIDL2039 : interface does not conform to [oleautomation] attribute : [ Parameter 'lOp1' of Procedure 'TestArray' ( Interface 'IMath' ) ]
error MIDL2139 : type of the parameter cannot derive from void or void * : [ Type 'PVOID' ( Parameter 'plResult' ) ]
error MIDL2105 : pointee / array does not derive any size : [ Field 'rgsabound' of Struct 'tagSAFEARRAY' ( Parameter 'plResult' ) ]
error MIDL2040 : [out] only parameter cannot be a pointer to an open structure : [ Parameter 'plResult' of Procedure 'TestArray' ( Interface 'IMath' ) ]
warning MIDL2039 : interface does not conform to [oleautomation] attribute : [ Parameter 'plResult' of Procedure 'TestArray' ( Interface 'IMath' ) ]
Error executing midl.exe.

- 5 error(s), 2 warning(s)
是不是因为没有包括某些文件啊?
高手指点!
...全文
64 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sorry2000 2002-04-23
  • 打赏
  • 举报
回复
3x
U皮特U 2002-04-21
  • 打赏
  • 举报
回复
笔误,上句中"如[out,retval]SAFEARRAY(BYTE)* plResult"应为
"如[out,retval]SAFEARRAY(long)* plResult"
U皮特U 2002-04-21
  • 打赏
  • 举报
回复
idl中SAFEARRAY应加上类型说明,如[out,retval]SAFEARRAY(BYTE)* plResult (假设是long类型,当然还可以用其它自动化标准类型或在idl中说明的自定义结构)
idl中:
HRESULT TestArray([in] SAFEARRAY(long) lOp1,[out,retval] SAFEARRAY(long) * plResult);

.h中:
STDMETHOD TestArray(/*[in]*/ SAFEARRAY lOp1, /*[out,retval]*/ SAFEARRAY** plResult
huqiming 2002-04-21
  • 打赏
  • 举报
回复
如果是atl,不能用没有的类型做参数。

如果一定要用,好象需要用c++写com
dsoframer v2.3.0.0源码以及API文档. 新加的接口说明(开发接口) [color=red][b]当前版本:V2.2.0.8 2007-02-07[/b] [/color]下载控件需要登录 说明: 控件未经大批量测试,难免有Bug, 发现 Bug,请及时发帖或者Mail:wanhhf@gmail.com 版本修改记录: V2.2.0.8修改: 增加了N多个事件,挺不的东西 [id(DSOF_DISPID_WORD_DocumentChange), helpstring("DSOF_DISPID_WORD_DocumentChange")] HRESULT WORD_DocumentChange(); [id(DSOF_DISPID_WORD_DocumentBeforePrint), helpstring("DSOF_DISPID_WORD_DocumentBeforePrint")] HRESULT WORD_DocumentBeforePrint(); [id(DSOF_DISPID_WORD_WindowActivate), helpstring("DSOF_DISPID_WORD_WindowActivate")] HRESULT WORD_WindowActivate(); [id(DSOF_DISPID_WORD_WindowSelectionChange), helpstring("DSOF_DISPID_WORD_WindowSelectionChange")] HRESULT WORD_WindowSelectionChange(); [id(DSOF_DISPID_WORD_WindowBeforeRightClick), helpstring("DSOF_DISPID_WORD_WindowBeforeRightClick")] HRESULT WORD_WindowBeforeRightClick(); [id(DSOF_DISPID_WORD_WindowBeforeDoubleClick), helpstring("DSOF_DISPID_WORD_WindowBeforeDoubleClick")] HRESULT WORD_WindowBeforeDoubleClick(); V2.2.0.6修改: 修改Open,参数为空时候,一个小 Bug 修改了URL过长时候一个Bug 增加了一个替换文字的接口 long ReplaceText(BSTR strSearchText, BSTR strReplaceText, long lGradation); V2.2.0.2修改: 修改了HttpPost相对路径的一些问题。 V2.2.0.0增加: [id(0x00010041), helpstring("Get Rev Index")] HRESULT GetRevCount( [out,retval] long * pbool); [id(0x00010042), helpstring("Get Rev Index Info")] HRESULT GetRevInfo([in] long lIndex, [in] long lType, [out,retval] BSTR* pbool); [id(0x00010043), helpstring("Set Doc Prop")] HRESULT SetValue([in] BSTR strValue, [in] BSTR strName, [out,retval] long* pbool); [id(0x00010044), helpstring("Set Doc Variable")] HRESU

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧