The windows forms control library project (C++) I writes uses an unmanaged dll. The unmanaged dll has a header file (a Cheshire cat). And I just include it in the control library project. And calls functions in the unmanaged dll (of course with proper marshaling). This compiles and builds. The problem is when I go ahead to add the control to the tool box of my scaffolding, which is a Managed C++ winform application, VS2005 complains that it is not a .Net module.
我编写的windows窗体控件库项目(C ++)使用非托管dll。非托管dll有一个头文件(柴郡猫)。我只是将它包含在控件库项目中。并且在非托管dll中调用函数(当然还有正确的编组)。这编译和构建。问题是当我继续将控件添加到我的脚手架的工具箱时,这是一个托管C ++ winform应用程序,VS2005抱怨它不是.Net模块。
I have seen people converting using MFC dlls as windows forms controls. What am I doing wrong?.
我见过人们使用MFC dll转换为windows窗体控件。我究竟做错了什么?。
1 个解决方案
#1
Maybe it's because VS2005 does not find your native .DLL. This .DLL is searched in the "normal" manner for native .DLLs:
也许是因为VS2005找不到你原生的.DLL。对于本机.DLL,以“正常”方式搜索此.DLL:
- Current directory (I think it is mostly the start-up dir of VS)
- App direcotry (somewhere in %ProgramFiles%\Microsoft Visual Studio...)
- %PATH% dirs.
当前目录(我认为它主要是VS的启动目录)
App direcotry(在%ProgramFiles%\ Microsoft Visual Studio ...中的某处)
You could try to put your native DLL somewhere in the above mentioned dirs and try if you get better results.
您可以尝试将您的本机DLL放在上面提到的dirs中,并尝试获得更好的结果。
I would absolutely recommend to make your native part static and statically link it into your .NET project (if that is possible) because it would avoid the native .DLL finding problem. (This is what I did because of the many problems. For example we have a Translator tool [SDL Passolo] that can handle .NET DLLs and pack them into translator packages including all referenced DLLs...but only .NET DLLs but not native DLLs!).
我绝对建议让你的本机部分静态并静态地将它链接到你的.NET项目(如果可能的话),因为它可以避免本机.DLL查找问题。 (这是我所做的,因为有很多问题。例如我们有一个翻译工具[SDL Passolo]可以处理.NET DLL并将它们打包成翻译包,包括所有引用的DLL ......但只有.NET DLL但不是本机DLL文件!)。
#1
Maybe it's because VS2005 does not find your native .DLL. This .DLL is searched in the "normal" manner for native .DLLs:
也许是因为VS2005找不到你原生的.DLL。对于本机.DLL,以“正常”方式搜索此.DLL:
- Current directory (I think it is mostly the start-up dir of VS)
- App direcotry (somewhere in %ProgramFiles%\Microsoft Visual Studio...)
- %PATH% dirs.
当前目录(我认为它主要是VS的启动目录)
App direcotry(在%ProgramFiles%\ Microsoft Visual Studio ...中的某处)
You could try to put your native DLL somewhere in the above mentioned dirs and try if you get better results.
您可以尝试将您的本机DLL放在上面提到的dirs中,并尝试获得更好的结果。
I would absolutely recommend to make your native part static and statically link it into your .NET project (if that is possible) because it would avoid the native .DLL finding problem. (This is what I did because of the many problems. For example we have a Translator tool [SDL Passolo] that can handle .NET DLLs and pack them into translator packages including all referenced DLLs...but only .NET DLLs but not native DLLs!).
我绝对建议让你的本机部分静态并静态地将它链接到你的.NET项目(如果可能的话),因为它可以避免本机.DLL查找问题。 (这是我所做的,因为有很多问题。例如我们有一个翻译工具[SDL Passolo]可以处理.NET DLL并将它们打包成翻译包,包括所有引用的DLL ......但只有.NET DLL但不是本机DLL文件!)。