1 Replies - 779 Views - Last Post: 02 March 2013 - 09:11 PM Rate Topic: -----

#1 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 221
  • View blog
  • Posts: 1,478
  • Joined: 16-March 11

Com Interop VB6 Dll call in asp.net application

Posted 01 March 2013 - 05:30 PM

Hey guys,

I've written an application that calls functions from a com dll in my asp.net application(asp.net or vb.net the issue at hand is no different for either so I picked the more active forum). After using the CreateObject method to declare a new instance of my com dll class called Primary. I then use a simple function built in to return a string of the applications path, and it works fine. The problem I'm having is when I pass 3 string arrays byref to a few of the sub routines it returns a type mismatch error. The problem is not in finding the dll, or accessing the dll, it's something to do with the byref but in these particular functions I can't think of any way the developer can rewrite those functions to return the 3 arrays because from what I've read the error definitely has to do with the ByRef tag in the arguments. I've tried making sure the application is set for x86 to access the 32-bit dll. When I try to reference the dll directly all goes well, but after I instance the dll class

Dim k as New Nelk.Primary



It crashes showing me the following error

"Unable to cast COM object of type 'NelK.PrimaryClass' to interface type 'NelK._Primary'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B565523D-FF81-4005-A88E-574B704BDAFE}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."

I'm not sure why it says NelK.PrimaryClass as it's called NelK.Primary but maybe just a typo any who the rest of the error I have searched high and low to solve and cannot even find a real clue pertaining to the conditions of my problem. Any help is really appreciated thank you.

Is This A Good Question/Topic? 0
  • +

Replies To: Com Interop VB6 Dll call in asp.net application

#2 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 221
  • View blog
  • Posts: 1,478
  • Joined: 16-March 11

Re: Com Interop VB6 Dll call in asp.net application

Posted 02 March 2013 - 09:11 PM

Well I never seemed to figure it out. Seems to be some kind of issue involving ByRef in VB6 Functions, and Sub Routines. Best I could find was something to do with the Marshaling of data back and fourth. Anyways best bet for anyone who finds themselves in this predicament is stay away from ByRef, declare your function return types, and don't use variants as all data types inherit from type Object so that would just crash.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1