如何在 Visual C++ 中包含类型库项目?

发布于 2024-12-10 00:18:13 字数 826 浏览 0 评论 0原文

我正在开发一个 FireBreath 项目,该项目制作了一个包装 ActiveX 控件功能的插件应用程序。我什至有 ActiveX 控件的源代码。

根据 FireBreath 示例页中提供的示例,我编写了必要的包装类来包装 Active X 控件。

为了调用事件接口,firebreath项目中的activex控件的类和函数,我从firebreath示例页面下载的程序使用这样的语句来向项目公开activex控件类型信息

// Import the ActiveX control's typelib so we can easily call methods, etc.
// on the ActiveX control.
#import "PROGID:FBExampleCtl.xpcmdbutton" no_namespace, raw_interfaces_only$

但是当我使用类似的东西时在我的程序中,它给出错误无法找到标头中包含的类型库。

所以我无法理解如何将 activex 控件的类型库公开到我的项目中,以及如何使用我的程序中类型库中定义的方法和函数。

ps:1) 我还安装了Oleview来检查系统中是否有类型库。从那以后,我还尝试了像

#import "GUID of the typelibrary". But this also didnot work.

2) 这样的替代方案,我也尝试过

#import "myrequireddll.dll"  

,并且还提到了调试环境中 dll 的路径。但编译器仍然给出同样的错误,无法找到该文件。

I am working on a FireBreath project which makes a plugin application which wraps the functions of an ActiveX control. I even have the source code of the ActiveX control.

Based on a sample example provided in the FireBreath example page i coded the necessary wrapper class to wrap the Active X controls.

To call the event interfaces ,the classes and functions of the activex control from the firebreath project, the program which i downloaded from the firebreath example page uses a statement like this to expose the activex controls type information to the project

// Import the ActiveX control's typelib so we can easily call methods, etc.
// on the ActiveX control.
#import "PROGID:FBExampleCtl.xpcmdbutton" no_namespace, raw_interfaces_only$

But when i use something like this in my program it gives an error cannot find the type library included in the header.

So i am not able to understand how to expose the type library of the activex control to my project and also use the methods and functions defined in the type library from my program.

ps:1) I also installed Oleview to check whether the type library is avaiable in the system. From that i also tried an alternative like

#import "GUID of the typelibrary". But this also didnot work.

2) i also tried

#import "myrequireddll.dll"  

and also mentioned the path to the dll in debugging environment. But the compiler still gives the same error, unable to find the file.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

七色彩虹 2024-12-17 00:18:13

您可以使用以下 #IMPORT 指令直接在头文件 (.h) 中导入 TLB 文件

#import "C:\.tlb" no_namespace, raw_interfaces_only

You can import the TLB file directly in the header (.h) file using the following #IMPORT directive

#import "C:\<PATH_TO_YOUR_TLB_FILE>.tlb" no_namespace, raw_interfaces_only

谎言 2024-12-17 00:18:13

查看我的博客上的这篇文章为 MASM32 编程设置 Visual Studio 2010。它谈到了 MASM32 的设置,但它展示了如何添加第三方类型库并将文件包含到您的项目中。

Check out this post on my blog Setting up Visual Studio 2010 for MASM32 Programming. It speaks about setting up for MASM32 however, it shows how to add third party type libraries and include files to your project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文