ATL开发在IDL中定义了一个方法,参数的类型不可识别,怎么办?

jizhongbo99 2012-03-31 03:42:43
最近在用ATL封装一个COM接口,需要引用一个第三方的dll文件,我在头文件中通过import进行了引用,h和cpp中都能识别该第三方类库中的类型,但是idl中却识别不了作为函数参数的类型,怎么办?
...全文
229 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
lgstudyvc 2012-04-05
  • 打赏
  • 举报
回复
你用的第三方类型是不是标准类型,
不是的话就问问他们怎么转换
  • 打赏
  • 举报
回复
必须是IUnknown* 或者IDispatch*
其他类型不可,就会造成你这样的问题。
jizhongbo99 2012-04-04
  • 打赏
  • 举报
回复
CSDN原来也让人失望!
jizhongbo99 2012-04-04
  • 打赏
  • 举报
回复
怎么搞啊?
难道没人遇到过这样的问题吗?
jizhongbo99 2012-04-04
  • 打赏
  • 举报
回复
我用import试了,报错:错误 2 error C1004: 发现意外的文件尾 C:\Program Files\Skyline\TerraExplorer Pro\TerraExplorerX.dll 7 1 TSDI3DEngine


[Quote=引用 6 楼 的回复:]
引用 3 楼 的回复:

这个第三方库只有DLL文件,找不到他的IDL文件啊


这个是import指令来使用
[/Quote]
wshcdr 2012-04-03
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 的回复:]

这个第三方库只有DLL文件,找不到他的IDL文件啊
[/Quote]

这个是import指令来使用
jizhongbo99 2012-04-02
  • 打赏
  • 举报
回复
上面代码中红色字体标注的类型,是在第三方DLL中定义的。
jizhongbo99 2012-04-02
  • 打赏
  • 举报
回复
IDL文件如下:

import "oaidl.idl";
import "ocidl.idl";

[
object,
uuid(9C0BADE3-30DB-4037-A655-24128EA50623),
pointer_default(unique)
]
interface ISGWorldObject : IUnknown{
[] HRESULT Open([in] BSTR ProjectURL);
};
[
uuid(1B24D8D1-31CC-41BE-B35A-6AF4F955099C),
version(1.0),
]
library TSDI3DEngineLib
{
importlib("stdole2.tlb");
[
uuid(295A40CD-7B9C-480D-8958-1518AEB5D619)
]
dispinterface _ISGWorldObjectEvents
{
properties:
methods:
[id(1), helpstring("This event occurs after TerraExplorer finishes loading a Fly file.")] HRESULT OnLoadFinished(void);
[id(2), helpstring("This event indicates to the client the current status of the terrain analysis calculations.")] HRESULT OnAnalysisProgress([in] LONG CurrPos, [in] LONG Range, [in] VARIANT_BOOL* pbCancelled);
[id(3), helpstring("This event occurs before a presentation step is activated to notify the client that the step is being activated.")] HRESULT OnBeforePresentationItemActivation([in] BSTR PresentationID, [in] IPresentationStep61* Step);
[id(4), helpstring("This event occurs when a standard TerraExplorer menu command’s value is changed.")] HRESULT OnCommandValueChanged([in] LONG commandID, [in] VARIANT newVal);
};
[
uuid(A4431A01-0FE6-488E-8E3C-40104FB4DB6B)
]
coclass SGWorldObject
{
[default] interface ISGWorldObject;
[default, source] dispinterface _ISGWorldObjectEvents;
};
};

jizhongbo99 2012-04-02
  • 打赏
  • 举报
回复
这个第三方库只有DLL文件,找不到他的IDL文件啊
lion_wing 2012-04-01
  • 打赏
  • 举报
回复
http://blog.csdn.net/lion_wing/article/details/7401238
lion_wing 2012-03-31
  • 打赏
  • 举报
回复
你在IDL中import IDL文件,然后将相关的头文件添加到工程中,就可以了。

3,245

社区成员

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

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