How to use a com dll without embedded typelibrary in it?
-
There is a com dll written by C++ ATL. There is no embedded type library resource in it, although I have its type library(.tlb file) seperately. I can't add it to my C# project references. So, how should i do to use it?
-
use PInvoke to call C++ DLL. http://www.pinvoke.net/[^]
-
Thanks for your reply. As we know, an atl com dll only export five functions: DllCanUnloadNow,DllGetClassObject,DllRegisterServer,DllUnregisterServer. So, im afraid that couldn't help to reach my aim, right?
Because it exports the function DllRegisterServer I would assume, that this COM dll isn't
registered. Just use the regsrv32.exe to register it.Example:
regsvr32.exe [Path]example.dll
After you registered it, it should be visible in the COM tab of the "add reference" wizard.
Greetings Covean
-
Because it exports the function DllRegisterServer I would assume, that this COM dll isn't
registered. Just use the regsrv32.exe to register it.Example:
regsvr32.exe [Path]example.dll
After you registered it, it should be visible in the COM tab of the "add reference" wizard.
Greetings Covean
Oh, of course the com dll has been registered successfully. When add its reference by vs(it can be listed in the com tab list), vs will give me an error messagebox says "A reference to '*** Type Library' couldn't be added. This is not a COM component". But, if the dll has embedded type library in it, it will be ok.
-
Oh, of course the com dll has been registered successfully. When add its reference by vs(it can be listed in the com tab list), vs will give me an error messagebox says "A reference to '*** Type Library' couldn't be added. This is not a COM component". But, if the dll has embedded type library in it, it will be ok.
-
Thanks for your reply. As we know, an atl com dll only export five functions: DllCanUnloadNow,DllGetClassObject,DllRegisterServer,DllUnregisterServer. So, im afraid that couldn't help to reach my aim, right?
-
Sorry but I never ran in this problem, so I never had to find a solution for this.
Greetings Covean
-
Then rewrite the code to C#. Or create a new library in C++.NET, call your C++ATL. Then use this lib in C#.
My be. But my main problem is create the component class. You know, in C#, i just reference the com dll. If i have to use the raw com dll file as common unmanaged dll, im not sure how to create the object and how to translate parameters. So, I hope to add referenct it via its type library(.tlb file).