Re: vbs output to txt file
- From: "Paul Baker [MVP, Windows - SDK]" <paulb@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 18 Apr 2007 09:58:41 -0400
AL,
Yes, you have a good point. I guess I would have to see a specific real life
example to be able to express any further opinion. This debate is getting a
bit too theoretical for me.
Paul
"Al Dunbar" <AlanDrub@xxxxxxxxxxxxxxxxxxx> wrote in message
news:%23jiRnbUgHHA.4156@xxxxxxxxxxxxxxxxxxxxxxx
I think it likely that we may never resolve this until we run across an
actual situation that always behaves in exactly the manner you describe,
or, alternately, one that fails only under certain circumstances.
Look at it this way: Are you a good enough scripter/programmer to design a
COM object that will fail as you describe, but ONLY under certain
circumstances? Granted, you would probably have to purposefully use bad
technique. Regardless, if you could do it on purpose, then I would posit
that someone else could do it by mistake. If neither of us could do it,
however, that wouldn't prove that nobody could. And if somebody/anybody
could do it on purpose, then I'd suggest (again) that someone could do it
by accident.
/Al
"Paul Baker [MVP, Windows - SDK]" <paulb@xxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:%23vgOV1PgHHA.4156@xxxxxxxxxxxxxxxxxxxxxxx
Al,
I admit I might be pushing my personal views a little too much here.
I'm saying that the argument goes that some COM objects may have to be
released in a particular order. The only logical reason for this would be
that one depends on another (which may or may not be obvious to the
caller) but does not add a refence to its dependancy. In this case, if it
is going to fail when unloaded in the wrong order, it will alwyas* fail
and it will be fairly obvious what the problem is. You can then choose to
workaround it or to look at another solution.
Paul
"Al Dunbar" <AlanDrub@xxxxxxxxxxxxxxxxxxx> wrote in message
news:Ou2oIMIgHHA.588@xxxxxxxxxxxxxxxxxxxxxxx
If only it were that easy. Are you saying, then, that, if my script does
not crash as a result of some problematic COM object not cleaning up
after itself properly, that it will never crash that way under any
circumstances?
As an example, consider a simple MATH COM object that has methods for
doing arithmetic. It won't crash when trying to divide by zero if the
code I write that calls it simply never causes it to divide by zero.
/Al
"Paul Baker [MVP, Windows - SDK]" <paulb@xxxxxxxxxxxxxxxxxxxxxxx> wrote
in message news:OjApZxCgHHA.4156@xxxxxxxxxxxxxxxxxxxxxxx
Just don't set anything to Nothing ever. If you need to release things
in a particular order, you'll find out when it crashes. Then go find a
"real" COM server and use it instead ;) I don't see how you would
necessarily know which order to release them in anyway.
"Al Dunbar" <AlanDrub@xxxxxxxxxxxxxxxxxxx> wrote in message
news:%233mc8xqfHHA.3632@xxxxxxxxxxxxxxxxxxxxxxx
Thanks. Now all I need is a list of those COM servers written "poorly"
and those written "well" so I will only set variables to nothing when
it is actually necessary ;-)
/Al
"Paul Baker [MVP, Windows - SDK]" <paulb@xxxxxxxxxxxxxxxxxxxxxxx>
wrote in message news:e$tIQ$cfHHA.1220@xxxxxxxxxxxxxxxxxxxxxxx
Al,
You are correct, some poorly written COM servers may require you to
release related objects in a particular order. I touched on this in
another thread. You would have to know the correct order to release
the objects in, which may be reverse order. Or maybe not! As far as I
know, so far everyone who has said that they religiously set
variables to Nothing has not described a tactic for getting this
order right. They have merely said that they have to do it (in some
order) because if this issue. It doesn't quite add up.
(Of course, a COM object should itself have a reference to any other
COM object on which it depends so this doesn't happen).
Paul
"Todd Vargo" <tlvargo@xxxxxxxxxxxxxx> wrote in message
news:eyOuaHXfHHA.5052@xxxxxxxxxxxxxxxxxxxxxxx
Al Dunbar wrote:
...
"Paul Baker [MVP, Windows - SDK]" <paulb@xxxxxxxxxxxxxxxxxxxxxxx>
wrote in
message news:%23oEWE6FfHHA.4560@xxxxxxxxxxxxxxxxxxxxxxx
IUnknown.These objects are COM objects and reference counted through the
itGoing out of scope is a decrement of the reference count. Just
because
doesn'tis not obvious that VB or VBScript is doing all this magic for
you
alwaysmean that it is not.
Agreed. But does hearing you say it does this magic mean that it
will
do the right thing in every possible instance? Are there perhapsexample,
interactions and relationships between COM objects that would, for
require them to be "released" in a particular order?
Seems logical that if objects are automagically released, one would
expect
the stack to be popped in reverse order of creation. OTOH, one can
always
test to avoid asking. {wink}
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal
messages)
.
- References:
- vbs output to txt file
- From: Cactus Johnson
- Re: vbs output to txt file
- From: Richard Mueller [MVP]
- Re: vbs output to txt file
- From: TheScriptLibrary.com
- Re: vbs output to txt file
- From: Al Dunbar
- Re: vbs output to txt file
- From: mr_unreliable
- Re: vbs output to txt file
- From: Paul Baker [MVP, Windows - SDK]
- Re: vbs output to txt file
- From: Al Dunbar
- Re: vbs output to txt file
- From: Todd Vargo
- Re: vbs output to txt file
- From: Paul Baker [MVP, Windows - SDK]
- Re: vbs output to txt file
- From: Al Dunbar
- Re: vbs output to txt file
- From: Paul Baker [MVP, Windows - SDK]
- Re: vbs output to txt file
- From: Al Dunbar
- Re: vbs output to txt file
- From: Paul Baker [MVP, Windows - SDK]
- Re: vbs output to txt file
- From: Al Dunbar
- vbs output to txt file
- Prev by Date: Re: vbs output to txt file
- Next by Date: Re: Is it possible to use a predefined variable for group name as
- Previous by thread: Re: vbs output to txt file
- Next by thread: Re: vbs output to txt file
- Index(es):
Relevant Pages
|