Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15583

VB6 - Multithread: the CreateThread(), accept parameters for the function?

$
0
0
the CreateThread(), accept parameters(even arrays) for the adressed function?
Code:

Public Sub Thread( byref start as long)

Dim i As Long
i=start
    Do While True

        Form1.botton.Caption = i

        i = i + 1

        If i > 32000000 Then i = 0

    Loop

End Sub

Code:

Public hThread1 As Long, hThread1_ID As Long
hThread1 = CreateThread(ByVal 0&, ByVal 0&, AddressOf Thread, _

ByVal 0&, ByVal 0&, hThread1_ID)

Now we must destroy the Thread:
Code:

TerminateThread hThread1, 0
CloseHandle hThread1

anotherthing: how i know the Thread is finish? we can't destroy the Thread before finish it

Viewing all articles
Browse latest Browse all 15583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>