模块里:
Public Sub ThreadProc1()
   MsgBox "send"
   Dim dc As Long
   dc = GetDC(formhandle)
   While True
      If IsInit Then
          Call Console.Send(GetServer, GetUID, GetPWD, GetDataBase)
      Else
          Unload Console
      End If
      Call Sleep(GetTimes)
   Wend
   Call ReleaseDC(formhandle, dc)
   Call EnterCriticalSection(sect)
   Call LeaveCriticalSection(sect)
End SubPublic Sub ThreadProc2()
   Dim dc As Long
   dc = GetDC(formhandle)
   While True
      If IsInit Then
          Call Console.Recieve(GetServer, GetUID, GetPWD, GetDataBase)
      Else
          Unload Console
      End If
      Call Sleep(500)
   Wend
   Call ReleaseDC(formhandle, dc)
   Call EnterCriticalSection(sect)
   Call LeaveCriticalSection(sect)
End Sub
form里:
Private Sub Start_Command_Click()
                Dim threadid1 As Long
                Dim threadid2 As Long
                
                CreateThread Null, ByVal O&, AddressOf ServiceModule.ThreadProc1, VarPtr(0), ByVal 0&, threadid1
                Call CreateThread(Null, ByVal 0&, AddressOf ServiceModule.ThreadProc2, VarPtr(0), ByVal 0&, threadid2)
End Sub