.NET COM Interop problem
-
Hello folks, This one has been bugging me for quite a while, I sort of have a solution but it is quite time conuming. I have a DLL written in VB.NET that I would like to use in console applciation C++. Project properties in VB.NET are set for COM interop, and I can see in the registry after I run it. The problem comes up when I try to use if in C++. Here is import statement: #import "\VOT\ADLL\ADLL\bin\Debug\AndrDLL.tlb" raw_interfaces_only raw_native_types no_namespace but I cannot even expose methods correctly, C++ does not see the interface... One way to fix is rewriting Vb project to C# project. Can anyone suggest something better and faster? Thanks in advance. Sincerely, Max Pastchenko
-
Hello folks, This one has been bugging me for quite a while, I sort of have a solution but it is quite time conuming. I have a DLL written in VB.NET that I would like to use in console applciation C++. Project properties in VB.NET are set for COM interop, and I can see in the registry after I run it. The problem comes up when I try to use if in C++. Here is import statement: #import "\VOT\ADLL\ADLL\bin\Debug\AndrDLL.tlb" raw_interfaces_only raw_native_types no_namespace but I cannot even expose methods correctly, C++ does not see the interface... One way to fix is rewriting Vb project to C# project. Can anyone suggest something better and faster? Thanks in advance. Sincerely, Max Pastchenko
Has anyone, in fact, successfully used a VB.NET dll in C++. I wrote a small VB project that creates dll, which just adds two numbers. I get some exception. While the code converted to C# works fine. this is my code: ICalculatorPtr mycalculator("CompareDLL.Test"); long one = 10; long two = 20; long lBla; mycalculator->Add(one,two,&lBla); if I try to use ICalculator, i get error message cannot create abstract class... :( Sincerely, Max Pastchenko
-
Has anyone, in fact, successfully used a VB.NET dll in C++. I wrote a small VB project that creates dll, which just adds two numbers. I get some exception. While the code converted to C# works fine. this is my code: ICalculatorPtr mycalculator("CompareDLL.Test"); long one = 10; long two = 20; long lBla; mycalculator->Add(one,two,&lBla); if I try to use ICalculator, i get error message cannot create abstract class... :( Sincerely, Max Pastchenko
writing an answer, to one part pf problem. for previous post: initializing COM actually worked :-) // initialize COM HRESULT hr = CoInitialize(NULL); Sincerely, Max Pastchenko
-
writing an answer, to one part pf problem. for previous post: initializing COM actually worked :-) // initialize COM HRESULT hr = CoInitialize(NULL); Sincerely, Max Pastchenko
Is it possible that DLL project is implemented incorrectly? I still dont see my interface in the dropdown..... Sincerely, Max Pastchenko
-
Is it possible that DLL project is implemented incorrectly? I still dont see my interface in the dropdown..... Sincerely, Max Pastchenko
.hmmmmmmm There is something I am confused about now, I hope someone can clarify this for me SO i have added one method to an interface in VB.NET created DLL used it in C++ works fine. Now, I add another method to it, it does not display second method. When I delete original method from VB.NET code, in C++ it still sees it present in the dropdown but gives me compilation error. Can someone please clarify this? Sincerely, Max Pastchenko
-
.hmmmmmmm There is something I am confused about now, I hope someone can clarify this for me SO i have added one method to an interface in VB.NET created DLL used it in C++ works fine. Now, I add another method to it, it does not display second method. When I delete original method from VB.NET code, in C++ it still sees it present in the dropdown but gives me compilation error. Can someone please clarify this? Sincerely, Max Pastchenko
problem solved. Every time VB builds a project, a .tlb is created (privided COM Interop option is chosen) This tlb is linked with a C++ project that uses .DLL. So when I already have a .tlb and decide to rebuild my VB DLL project a tlb is basically recreated. The solution i found for myself is to rebuild my DLL project after closing C++ project and then opening C++ project again. Of course initializing COM is another thing that needs to be done to properly use DLL Sincerely, Max Pastchenko