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.
精彩评论