COM doesn't work in VB.net

P

Petar Popara

I have created several COM objects (inside one DLL) which works fine in
JScript and VBScript (when called using cscript). It also works fine when
called from Visual C++ 6, Delphi 7 and FoxPro 6.

It doesn't work when called from VB.Net 2003. :( The error is:

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in Test.exe
Additional information: COM object with CLSID {12345678-...-123456789012} is
either not valid or not registered.

Other COM objects from the same DLL works fine, but only this object
fail during initialisation:

Dim myApp As New MYAPPCOMLib.MyClass

What should I do?
 
J

JohnFol

Hi Petar, this isn't my speciality, but I tried a few walkthroughs and have
sucessfully done this. The step that I think is missing is exporting the
type library that allows .Net managed code to inter-operate with non-managed
dll's

This is taken from MSDN:


This example shows you how to create an AVI viewer using TlbImp. The program
reads an AVI filename from the command line, creates an instance of the
Quartz COM object, then uses the methods RenderFile and Run to display the
AVI file.

These are the steps to build the program:

a.. Run TlbImp over the TLB. The Media Player used in this example is
contained in Quartz.dll, which should be in your Windows system directory.
Use the following command to create the .NET Framework DLL:
tlbimp c:\winnt\system32\quartz.dll /out:QuartzTypeLib.dll
 
P

Petar Popara

Thank you very much for this tip.

Please, could you show me what should I do with new (type lib) DLL? How can
I include it in my project and use it?

I'm not expirienced with .Net. :(
 
P

Petar Popara

Use the following command to create the .NET Framework DLL:
tlbimp c:\winnt\system32\quartz.dll /out:QuartzTypeLib.dll

Have tried that and still doesn't work. :(
 
J

JohnFol

Once you have the new dll, copy it and the tlb to your bin directory (just
to keep it separate from the original). Then your project references the new
one, not the original.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top