释放资源是这样的:
如果有Close之类的方法,先执行o.Close()
然后 o=null;
但是,如果不关闭打开了该网页的浏览器,该ActiveX相应的dll文件将被一直占用,无法删除或修改这个没办法,IE的机制就是这样

解决方案 »

  1.   

    In both JScript and VBScript, the object referenced by an object variable 
    will be destroyed when the object goes out of scope if it is never 
    explicitly set to nothing (VBScript) or null (JScript). The difference is what happens when you do set the object to nothing/null. 
    In VBScript, that immediately destroys the object. In JScript, the object 
    is destroyed when the garbage collector runs, which could be any time ( or forever if the free memory never drops).The JScript garbage collector works like this: 
    1) When the script engine is shut down, garbage is collected. 
    2) When 256 variants are allocated, or when more than 64K is allocated, 
    then the garbage collector sets a flag that says "collect soon". 
    3) Whenever a new statement is executed OR we break into the script 
    debugger, we check that flag, and if it is set, we do a collection. For TESTING purposes, there is a "collectGarbage" function which forces a 
    collection. I don't recommend shipping code that uses this function -- you 
    should design your programs to work well with automatic memory management. 
    If you have an algorithm which _depends_ on having a predictable collection 
    sequence, JScript is not an appropriate language for you to solve your 
    problem. Use a language with predictable GC behaviour, like VBScript.
      

  2.   

    这也是基于安全考虑的啊~~网页里使用ActiveX的时候都会给予提示的如果你能在使用过程中有把它替换掉了,那系统到底要不要再次提示呢?如果不提示的话,你要是换了个病毒程序,那么第一次的提示就显得没必要了如果提示的话,整个程序的连贯性就大打折扣了所以还不如不让替换的好~~p.s:以上言论纯属猜测,HOHO ~~