Hiw
I built ActiveEXE Server for Multithreading ..
I hope the ActiveXExe Server finish of itself..
So I used Timer control and Running State values...
The Problem is this :
the Instance of this Class does not end of itself...
Class_Terminate is called by Program.. but it still lives on memory
how can I do my ActiveEXE be finished automatically ... ??
See my Class....
------------------------------------------------------------
Private frm As Form
Private WithEvents Ti As Timer
Public Event ListDone(ByVal i As Long)
Private mStartInt As Long
Private mRunState As Boolean
Private AppRunning As Boolean
Private Sub LoadAXFrm()
Dim i As Long
For i = 1 To 1000
Do
If mRunState Then Exit Do
DoEvents
Loop
DoEvents
RaiseEvent ListDone(CLng(mStartInt + i))
Next
End Sub
Public Sub EndClass()
mRunState = False
Call Class_Terminate
End Sub
Private Sub Class_Initialize()
mRunState = False
AppRunning = False
Set frm = frmAX
Set Ti = frmAX.Timer1
End Sub
Private Sub Class_Terminate()
Set frm = Nothing
Set Ti = Nothing
End Sub
Public Property Get StartInt() As Long
StartInt = mStartInt
End Property
Public Property Let StartInt(ByVal vNewValue As Long)
mStartInt = vNewValue
Ti.Enabled = True
Ti.Interval = 500
End Property
Public Property Let RunState(ByVal vNewValue As Boolean)
mRunState = vNewValue
End Property
Public Property Get RunState() As Boolean
RunState = mRunState
End Property
Private Sub Ti_Timer()
If mRunState <> True Then Exit Sub
If AppRunning = False Then
Ti.Enabled = False
Call LoadAXFrm
AppRunning = True
Call Class_Terminate --> It calls Class_Terminate correctly..
End If
End Sub

Signature
+++++++++++++++++++++++++++++
±èÈ¿ÇÑ / Hyo-Han Kim
e-Biz Dept./ Director
phone : +82.2.576.3114
mobile : +82.17.288.6714
e.mail : blueless@esql.co.kr
+++++++++++++++++++++++++++++
Tony Proctor - 28 Feb 2005 15:28 GMT
When all clients have disconnected (i.e. when all instantiated objects have
been destroyed) then it should close down itself. Hence, it sounds like
something is not being closed down properly. This will be tricky to find
because the debugger does not debug multi-threaded code -- it always forced
it to run in a single thread.
One worry I would have (which may not be related to your problem) is that
you're using a form-based timer. See
http://support.microsoft.com/default.aspx?scid=kb;EN-US;241896
Tony Proctor
> Hiw
> I built ActiveEXE Server for Multithreading ..
[quoted text clipped - 84 lines]
>
> End Sub
Ken Halter - 28 Feb 2005 15:39 GMT
> Hiw
> I built ActiveEXE Server for Multithreading ..
Objects aren't allowed to kill themselves <g>.. They die naturally when all
references have been released. Since you probably have a form loaded in that
ActiveX exe, it won't die by itself. You'll need to add a public method that
acts like a reference counter. When that counter reaches 0, unload your
form. When the last caller sets the instance to Nothing (after calling that
new method), the component should die.
Another option is to use a formless timer. There are plenty of examples on
Google... here's one....
Subject: Re: Timer In VB With No Form
http://groups.google.co.uk/groups?hl=en&lr=&selm=d2tr3ukt33u5lsh4ucdvrfc14enpv76
vm2%404ax.com

Signature
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..