PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Art Araya on May 03, 2005, 05:18:57 PM

Title: Does IsObject work with DISPATCH variable?
Post by: Art Araya on May 03, 2005, 05:18:57 PM
Dispatch variable newbie question...

I am using a DISPATCH variable to access an ActiveX DLL's properties and methods.  I'd like to validate that the DLL is properly installed and registered before calling any of the properties/methods.

Can I use the IsObject function to validate a DISPATCH variable?

TIA
Title: Does IsObject work with DISPATCH variable?
Post by: Jose Roca on May 03, 2005, 09:10:09 PM
Yes, of course.
Title: Does IsObject work with DISPATCH variable?
Post by: Art Araya on May 03, 2005, 10:41:17 PM
Thanks Jose.  Coming from a VB background alot of these concepts are new to me.  VB has objects but we never have to explicitly deal with or be aware of Dispatch variables and neither the PB or FF documentation seemed to address this.

Trial and error testing seemed to show that IsObject could work with a Dispatch variable but I was looking for something more definitive.

Thanks again
Title: Does IsObject work with DISPATCH variable?
Post by: Jose Roca on May 03, 2005, 10:58:53 PM
The real difference between object and dispatch variables is that object variables are used for early binding and dispatch variables for late binding. If you use object variables you have to make an interface with the PB COM browser, that the compiler uses to retrieve the DispID at compile time to construct the call to Invoke. With dispatch variables, the compiler adds a call to GetIDsOfNames, that retrieves the DispID at runtime.