回复 2# pusofalse
非线程安全的原因么?应该是一次只能运行一个线程?
Global $hThread = DllCallbackRegister("_ThreadProc", "DWORD", "ptr")
Global $i = 1
While $i < 10
MsgBox(0, "Main", "press Ok To Start " & $i & " Thread!")
DllCall("Kernel32.dll", "HANDLE", "CreateThread", "ptr", 0, "ptr", 0, "ptr", DllCallbackGetPtr($hThread), "DWORD", 0, "ptr", 0, "DWORD_PTR", 0)
WEnd
While 1
Sleep(20)
WEnd
Func _ThreadProc($Param)
Local $Nowtemp =$i
$i += 1
MsgBox(0, "", "Hello! now $i = " & $i)
While 1
Sleep(1000)
ConsoleWrite($Nowtemp &" :--"& @SEC&@CRLF)
WEnd
EndFunc
|