ShogenOFF,
Попробуйте так:
Код:
While 1
$ahCallBack_1 = _CallBack_Init("My_Func_1", 5555)
$ahCallBack_2 = _CallBack_Init("My_Func_2", 2222)
My_Func_3()
WEnd
Func My_Func_1()
Local $iX = Random(1, @DesktopWidth - 50, 1), $iY = Random(1, @DesktopHeight - 50, 1)
MouseMove($iX, $iY)
EndFunc ;==>My_Func_1
Func My_Func_2()
SoundPlay(@WindowsDir & "\media\tada.wav")
EndFunc ;==>My_Func_2
Func My_Func_3()
While 1
MsgBox(0, "", "Будут работать все 3 функции, пока не нажмешь OK")
ExitLoop
WEnd
_CallBack_Free($ahCallBack_1)
_CallBack_Free($ahCallBack_2)
Exit
EndFunc ;==>My_Func_3
Func _CallBack_Init($sFuncName, $iTime, $sParam = "")
Local $hCallBack = DllCallbackRegister($sFuncName, "int", $sParam)
Local $aTimer = DllCall("user32.dll", "uint", "SetTimer", _
"hwnd", 0, "uint", 0, "int", $iTime, "ptr", DllCallbackGetPtr($hCallBack))
Local $ahCallBack[2] = [$hCallBack, $aTimer[0]]
Return $ahCallBack
EndFunc ;==>_CallBack_Init
Func _CallBack_Free($ahCallBack)
If $ahCallBack[0] <> -1 Then DllCallbackFree($ahCallBack[0])
If $ahCallBack[1] <> -1 Then DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "uint", $ahCallBack[1])
EndFunc ;==>_CallBack_Free