|
 |
asp_components thread: Return Handle from a Com(ATL) component
Message #1 by "yaniv" <YanivN@w...> on Tue, 26 Sep 2000 13:51:19 +0100
|
|
hello,
I would like to return a pointer to a class to my asp program
but I am keep getting he number - 0 when I try to do that
I do success to return regular types as char*,int
thanks
Message #2 by "Stephen Haberman" <stephenh@c...> on Tue, 26 Sep 2000 12:04:34 -0500
|
|
VBScript can only handle variants... I have very little experience in this,
but from what I've picked up you'd do something like this:
// Create the variable
VARIANT ptrToYourClass;
VariantInit(*ptrToYourClass);
// Assign what type of variant it is...I'm guessing here,
// but I think it'd be a pointer to the IDispatch interface
// of the class
ptrToYourClass.vt = VT_DISPATCH;
// Assign the actual pointer
ptrToYourClass.lVal = &yourClass;
return ptrToYourClass;
Some potential problems is that I don't know of your class will still be
around after it returns to ASP. I would assume if you don't do Set myObj
Nothing, it'd still be around, and that if you do destory the object, the
class would be destroyed along with it, however I'm guessing here and you'd
have to try it to make sure.
The other is that (again, I just started doing components in ASP so I'm not
sure about this) I think ASP/VBScript can only work with the IDispatch
interface of an object/class. So you might have to implement that interface
on the class your trying to return.
I'm sorry I can't provide more concrete answers, but that's what I'd try
doing if I were in your situation.
Hope that helps,
Stephen
> -----Original Message-----
> From: yaniv [mailto:YanivN@w...]
> Sent: Tuesday, September 26, 2000 7:51 AM
> To: ASP components
> Subject: [asp_components] Return Handle from a Com(ATL) component
>
>
> hello,
> I would like to return a pointer to a class to my asp program
> but I am keep getting he number - 0 when I try to do that
> I do success to return regular types as char*,int
> thanks
>
|
|
 |