在 C# PInvoke 中为 CRegObject 方法引用什么 DLL?
我需要引用什么 DLL 才能从 C# 访问 CRegObject 的 FilerRegister 方法?
[DllImport("ATL90.DLL")]
public static extern int FileRegister(string fileName);
我该如何在视觉工作室中做到这一点?
非常感谢任何帮助!我似乎找不到正确的 DLL。我查了一下pinvoke.net,但没有找到。
谢谢!
What DLL do I need to reference to access FilerRegister method(s) of the CRegObject from C#?
[DllImport("ATL90.DLL")]
public static extern int FileRegister(string fileName);
And how would I do that in visual studio?
Any help is greatly appreciated! I can't seem to find the correct DLL. I looked on pinvoke.net, but couldn't find it.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能。 P/Invoke 仅适用于 C API,不适用于 C++ API。此外,该特定 API 是在内联 C++ 中实现的,它实际上并未包含在 ATL DLL 中。
我相信您能做的最好的事情就是编写一个 C++/CLI 包装器并从 C# 代码中调用那个。或者获取 C++ 源代码(包含在 Visual Studio 中)并用 C# 重写。
如果您包含有关为什么要调用
FileRegister
的更多详细信息,那么也许还有其他替代方案...You can't. P/Invoke only works with C APIs, it does not work with C++ APIs. Besides, that particular API is implemented in inline C++, it's not actually included in the ATL DLL.
I believe the best you could do is write a C++/CLI wrapper and call that from the C# code. Or take the C++ source code (which is included with Visual Studio) and rewrite it in C#.
If you include more details about why you want to call
FileRegister
, then maybe there are other alternatives...