Page 1 of 1 1
Topic Options
#85180 - 2002-03-01 03:33 PM $Value = CreateObject(...)???
JohnGH Offline
Fresh Scripter

Registered: 2002-01-03
Posts: 27
I am making a component myself, but I run in to some problems.
What I do:
$Value=CreateObject(...)
If $Value
$Value.Dosomething
$Value.Kill
EndIf
If $Value
?"Object still exists"
EndIf

When I do this I will see the line "Object still exists".
The reason for doing this is that it runs the component while the component exists it will check for an update. I the update is available it should copy it, but after killing the object.

How can I check if the object is still running?

John

Top
#85181 - 2002-03-01 03:43 PM Re: $Value = CreateObject(...)???
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hi john,
instead of using $value.kill, why don't you just do a $value=""?
_________________________
!

download KiXnet

Top
#85182 - 2002-03-01 03:47 PM Re: $Value = CreateObject(...)???
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I missed your final question here...
to check for running object, the object itself has to have a internal way of informing if it's busy...
like if $value.busy ;it's still working hard
or then it may (like I quess in most of the cases) return to script when it has finished it's job, so the script is halted until that...
but the total destroyal of the object is done by reallocating it's handle with something...
like $value="" or $value=0
_________________________
!

download KiXnet

Top
#85183 - 2002-03-01 04:05 PM Re: $Value = CreateObject(...)???
JohnGH Offline
Fresh Scripter

Registered: 2002-01-03
Posts: 27
Well the object is an ActiveX Executable.
I'm running it on Win98 and when I look in the taskmanager it's listed.
When I use the $Value.kill, it's completely
unloaded and not visible in the taskmanager.
Only the "if $value" still returns true.
Knowing that the component is gonna get a bit bigger I want to add a while loop to see if it has unloaded before I copy the file.
What I used now (which doesn't work):
While $value
sleep 2
Loop

How can I solve this?
If I'd use $value="" then I can't see if it has really unloaded the component.

John

Top
#85184 - 2002-03-01 04:10 PM Re: $Value = CreateObject(...)???
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
mmm...
well, I quess it does quarantee that it's then unloaded...
a paste from kix-manual
quote:
To release all system and memory resources associated with an object, simply assign any other value to the variable:

$Object = 0


_________________________
!

download KiXnet

Top
#85185 - 2002-03-01 04:30 PM Re: $Value = CreateObject(...)???
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Lonkero hit the nail on the head ... you should build-in a gracefull shutdown if you need it, like this:

$object.quit

then ask kix to perform a COM Release on your object, like this:

$object = 0

but ultimately, its up you (your component) to unload itself memory if it's reference count drops to zero, especially for out-of-proc COM objects like you have.

-Shawn

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2312 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.057 seconds in which 0.027 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org