G
Guest
Hi
I'm currently working with vbscripting through MSScriptControl. We have
shared some of our objects that should be available for scripting.
Some of the functions of these objects will return an interface to a class
that must be cast to the appropriate higher level class to use all
functionality.
Thus I tried to implement a generic cast function for use from the vbscript
side that would take an object and a typestring and convert the object to
chosen type.
Ex: set myObject = Converter.Convert(myInterfaceObject,
"MyProgram.MyNamespace.MyObject")
To be able to use the object fully, I would have to return an object of the
correct type. I tried to implement this via generics and instancing via
reflection, but I always seemed to fail on the point where I could not have a
function return a generic without somewhere specifying hardcoded what that
generic would be.
Has anyone been able to implement a cast function usable in this manner? Or
is there a support in the framework for doing it?
Thanks for your help.
/K
I'm currently working with vbscripting through MSScriptControl. We have
shared some of our objects that should be available for scripting.
Some of the functions of these objects will return an interface to a class
that must be cast to the appropriate higher level class to use all
functionality.
Thus I tried to implement a generic cast function for use from the vbscript
side that would take an object and a typestring and convert the object to
chosen type.
Ex: set myObject = Converter.Convert(myInterfaceObject,
"MyProgram.MyNamespace.MyObject")
To be able to use the object fully, I would have to return an object of the
correct type. I tried to implement this via generics and instancing via
reflection, but I always seemed to fail on the point where I could not have a
function return a generic without somewhere specifying hardcoded what that
generic would be.
Has anyone been able to implement a cast function usable in this manner? Or
is there a support in the framework for doing it?
Thanks for your help.
/K