使用 C++ vb.net 应用程序中的头文件?
在 VB.NET 应用程序中使用 C++ 头文件的最简单方法是什么? 我需要访问通过自定义 VB.NET Windows 应用程序的头文件定义的 API。
What is the simplest way to use a C++ header file in a VB.NET application?
I need to access an API defined via the header file for a custom VB.NET windows app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 VB.NET Declare 语句 重新声明 API 函数代码。如果头文件包含类,这将不起作用,您需要 编写包装器< /a> 使它们可用。
Use the VB.NET Declare statement to redeclare the API function in your code. This will not work if the header file contains classes, you'll need to write a wrapper to make those usable.
使用 PInvoke Interop Assistant 将 C++ 标头转换为 PInvoke声明。
如果您有 C++ 项目的完整源代码,请使用 C++ 互操作 根据 whunmr 的建议。
Use the PInvoke Interop Assistant to convert the C++ header into PInvoke declarations.
If you have the full source code for the C++ project use C++ Interop as advised by whunmr.