PDA

Click to See Complete Forum and Search --> : help!!! program hangs


arnas
Oct 9th, 2000, 04:15 AM
I suppose program hangs because the thread doesn't terminates normally. please,take a look at the code
below:

option explicit
Dim myThread As New clsThreads 'the class of thread

Private Sub Form_Load()
myThread.Initialize AddressOf Flicker
myThraed.enable = true 'Flicker sub begins to work
end sub

Private Sub cmdStop_Click()
Set myThread = Nothing
End Sub

******** this is from clsThread class*********
Private Sub Class_Terminate()
Call TerminateThread(uThread.Handle, 0)
lng = CloseHandle(uThread.Handle)
End Sub
***********************************************

so, after I click "cmdStop" button, process stays still
active, but if I make:

Private Sub Form_Load()
myThread.Initialize AddressOf Flicker
SET MYTHREAD = NOTHING
end sub

EVERYTHING IS OK!!!!! so, why if I set class thread
to nothing in form_load sub, the thread terminates normally???

thank You!