'模块:Private Declare Function CreateThread Lib "kernel32" (ByVal lpThreadAttributes As Any, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadID As Long) As LongPrivate Declare Function TerminateThread Lib "kernel32" (ByVal hThread As Long, ByVal dwExitCode As Long) As LongPrivate Declare Function SuspendThread Lib "kernel32" (ByVal hThread As Long) As LongPrivate mThreadHandle As Long'示例Function addnumber() As Long Dim i As Long For i = 0 To 100000 Form1.Label1.Caption = i NextEnd Function'创建线程Public Function CreateNewThread(ByVal cFunction As Long) As Long Dim mhandle As Long Dim lpThreadID As Long mhandle = CreateThread(ByVal 0&, ByVal 0&, cFunction, ByVal 0&, 0, lpThreadID) If mhandle <> 0 Then mThreadHandle = mhandleEnd Function'终止线程Public Function TerminateTh() As Long SuspendThread mThreadHandle TerminateThread mThreadHandle, ByVal 0& TerminateThread lpThreadID, ByVal 0&End Function