$Handle1 = DllCallbackRegister("ThreadTest1", "int", "ptr")
$Handle2 = DllCallbackRegister("ThreadTest2", "int", "ptr")
Func CreateThread($Handle, $struct)
$return = DllCall("kernel32.dll", "hwnd", "CreateThread", "ptr", 0, "dword", 0, "long", DllCallbackGetPtr($Handle), "ptr", DllStructGetPtr($struct), "long", 0, "int*", 0)
Return $return[0]
EndFunc ;==>CreateThread
$Struct1 = DllStructCreate("Char[200];int")
DllStructSetData($Struct1, 1, 10)
CreateThread($Handle1, $Struct1)
$Struct2 = DllStructCreate("Char[200];int")
DllStructSetData($Struct2, 1, 10)
CreateThread($Handle2, $Struct2)
While 1
Sleep(10)
WEnd
Func ThreadTest1($x)
$y = DllStructCreate("char[200];int", $x)
$i = 0
While 1
MsgBox(0, $i, "Thread #1")
$i += 1
WEnd
EndFunc ;==>ThreadTest1
Func ThreadTest2($x)
$y = DllStructCreate("char[200];int", $x)
$i = 0
While 1
MsgBox(0, $i, "Thread #2")
$i += 1
WEnd
EndFunc ;==>ThreadTest2