'判断线程是否被终止 , 如果终止返回FALSE,如果还活着返回TRUE 
'IsThreadIdAlive(线程ID) as BOOL  
'GetCurrentThreadId 获取当前线程ID
'--------------------------------------------------------------------------
Function IsThreadIdAlive(ByVal dwThreadID as ULong) as BOOL
   '判断线程ID是否被终止 , 如果终止返回FALSE,如果还活着返回TRUE
   Dim bRet as BOOL, ExitCode as ULong
   Dim hThread as HANDLE = OpenThread(THREAD_QUERY_INFORMATION, False, dwThreadID)
   If hThread <> Null Then
      If GetExitCodeThread(hThread, @ExitCode) Then
         If ExitCode = STILL_ACTIVE Then bRet = True
      End If
      CloseHandle(hThread)
   End If
   Return bRet
End Function