开发者

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

开发者 https://www.devze.com 2023-04-12 02:00 出处:网络
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 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._Us开发者_C百科ers'. ... 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消