tag:blogger.com,1999:blog-36201586.post3332675130614226366..comments2023-01-05T21:58:34.019+00:00Comments on Derek says:: Windows Script Components as an alternative to COMDerek Fowlerhttp://www.blogger.com/profile/09963865123124577525noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-36201586.post-47670299131593883672009-06-03T01:52:59.754+01:002009-06-03T01:52:59.754+01:00Thanks Jan, they're both good points, especial...Thanks Jan, they're both good points, especially regarding apartment threading. I'll have to update the post.Derek Fowlerhttps://www.blogger.com/profile/09963865123124577525noreply@blogger.comtag:blogger.com,1999:blog-36201586.post-48359269693525805672009-06-02T23:08:52.973+01:002009-06-02T23:08:52.973+01:00Nice intro! I have a few comments though.
1. Usin...Nice intro! I have a few comments though.<br /><br />1. Using WSC i session- and application-scope is "dangerous" as WSC components are appartement threaded (and using appartement threaded components in these scopes is a sin :-)).<br /><br />2. cleanup (at least in VBScript) could be handled by creating a local class which implements initializer and desctructor-code for buildup and teardown. E.g.<br /><br />class CCleanup<br /> private sub class_initialize()<br /> ' create component ressources<br /> end sub<br /> private sub class_terminate()<br /> ' dispose of component ressources<br /> end sub<br />end class<br />dim objCleanup<br />set objCleanup = new CCleanup<br /><br />I believe this will work as COM will terminate the objCleanup when the WSC object leaves scope and itself is terminated. When this happens objCleanup.class_terminate is called and your cleanup is done.<br /><br /><br />Regards, JanJan Hansenhttp://www.softspot.dknoreply@blogger.com