Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I pass objects to a COM component?

Status
Not open for further replies.

mwinwright

IS-IT--Management
Jan 23, 2001
6
GB
I have a COM object from a VB6 app developed that gets the quote text for any particular product we supply to it. It's called as below in VB6:

a = clsText.GetText (clsComponent, clsProduct, Language)

clsComponent and clsProduct are objects called in a previous createobject. I know this works in VB, but can ASP pass objects like this? Hope I've made this clear enough!
 
I would say this should not be a problem. You need to make sure the COM object is installed and registered, and you might want to be extra careful with your variable declarations, but there's no reason to believe it won't work. CreateObject returns a memory structure appropriate for the type of object you want to create. If you pass that structure (object) to a method that is expecting that kind of object (memory structure), everything lines up just right. Good luck.
 
Thanks for the reply. I've registered the DLL and can even get another class to work but this is one that does not require objects to be passed e.g.
--------------------------
set objProduct = server.createobject("ConfiguratorDLL.clsProduct")
set objComponent = server.createobject("ConfiguratorDLL.clsComponent")call objProduct.get_components (strProduct , language)
response.write(objProduct.count)
--------------------------
Works OK. I can even get at other classes created within this createobject i.e objComponent actually exists within objProduct so the following works
------------------------------
for each objComponent in ObjProduct
response.write(objComponent.Product & " - ")
response.write(objComponent.FlowText & &quot;<br>&quot;)
next
------------------------------
But when I try to add
------------------------------
set objText = server.createobject(&quot;ConfiguratorDLL.clsText&quot;)
call objText.GetText (objComponent, objProduct, Language, objProduct.count)
-------------------------------
I then get the error, as below
-----------------------------
Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'GetText'
-----------------------------
This is probably hard to understand without knowing the DLL, but it's driving me mad as I'm nearly there. Any one any pointers?
 
Just an educated (or not so educated, possibly) guess, but I think the error lies within the sub/function itself (within the dll). What exactly does the GetText function do, could you perhaps post more fully the code to get a better understanding and possibly help trace the problem? Everything is absolute. Everything else is relative.
 
Hi mwinwright,

In your first post, you have called the function as follows:
a = clsText.GetText (clsComponent, clsProduct, Language)

In your last post, you have called it like this:
call objText.GetText (objComponent, objProduct, Language, objProduct.count)

The arguments you are passing don't match (you have one extra one (objProduct.count) in the code you are trying to run).

Hope this helps,
Cathy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top