Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


OLE Handle Reassignment

 Keywords:  

Question:

When assigning an OLE handle and then re-assigning it, does WIL automatically close the object to which the variable was previously assigned or should I do that manually? I'm re-assigning handles in a script I've written using the same variable name over an over and I want to know if I'm "polluting the environment".

Answer:

When a something containing an OLE object is assigned to a variable, a "reference count" is incremented for the ole object.

When variables containing an OLE object is dropped or reused the reference count is decremented. If the reference count goes to zero, the object is automagically closed.

Something like that anyway. The answer is yes you can just re-use the variable and don't have to worry about ObjectClosing it.