On Jul 4, 6:27*am, mr_unreliable <kindlyReplyToNewsgr...@xxxxxx>
wrote:
jw,
Thanks for the helpful, informative reply. I had tried wsc's but was
trying with "CreateObject". Now I know better.
My workaround for the other problem was to have a global sub call the
class member I really wanted to usr. This DOES work, but it breaks
encapsulation. Breaks it? Heck, it crushes it, but like I say, it
does work. Ugly, Ugly
I'll try the wsc approach for rev 2.0 This has the added advantage
that once created and working, I can just leave the class in a file
and the scripts that use it get leaner.
Thanks Again,
--Vorpal
> vorpal wrote:
> > Is there any way I can modify this so that the event handler is a
> > class member? >
> hi Vorpal, I don't think you are going to get a constructive
> answer to this query.
>
> I tried your modifying your code, and using "GetRef" to connect
> your subroutine to an object's events. *That didn't work either.
>
> I suspect that the scripting engine is looking for a "global"
> subroutine name to connect to, rather than looking for a sub
> name in the "class namespace". *I would consider this to be a
> "bug", but since microsoft has given up on maintaining vbs,
> reporting bugs is futile.
>
> As an alternative, you might consider restructuring your class
> code as a "windows script component" (a.k.a. a "wsc" file).
> WSC's are similar to class code, but structured a bit differently.
> More to the point, a wsc file DOES allow for sinking events.
> Instead of CreateObject, you use an object tag:
>
> <object id="oATO" progid="wshAPIToolkit.ucATO" events="True"
> reference="yes" />
>