dommer
dommer

Reputation: 19810

Why does my call to a VB6 ActiveX DLL from C# app fail with "No such interface supported"?

I have a VB6 Active DLL that I'm trying to call from C#.

I've converted it using tblimp and imported it into VS 2010.

I then instantiate it using:

AppWebActiveX.Users appWebActiveX = new appWebActiveX.Users();

There's a Users interface and a UsersClass class when I look in the object browser.

Then I call:

bool isExistingUser = appWebActiveX.IsExistingUser("cat");

bool IsExisting(string) is a valid method, according to the object browser.

However, this returns:

Unable to cast COM object of type 'AppWebActiveX.UsersClass' to interface type 'AppWebActiveX._Users'. ... No such interface supported ...

The latest stack call is to System.StubHelpers.StubHelpers.GetCOMIPFromRCW.

I'm running the app on Windows Server 2003 Standard Edition (x86 - 32bit) and it's a 32-bit DLL. I'm making the call from a C# console app.

Any advice?

Upvotes: 2

Views: 585

Answers (1)

dommer
dommer

Reputation: 19810

Turns out that I'd omitted the [STAThread] attribute from the main method.

Upvotes: 1

Related Questions