Code : Tout sélectionner
Structure ThreadComm
Var.l
Stop.l
EndStructure
Procedure EnThread(*ThreadComm.ThreadComm)
Repeat
*ThreadComm\Var+1
Until*ThreadComm\Stop
EndProcedure
If OpenWindow(0,0,0,320,320,#PB_Window_SystemMenu,"") And CreateGadgetList(WindowID(0))
TextGadget(0,0,0,320,320,"",#PB_Text_Center)
Thread=CreateThread(@EnThread(),@ThreadComm.ThreadComm)
settimer_(WindowID(0),1,20,0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
ThreadComm\Stop=1
If Thread
WaitThread(Thread)
EndIf
End
Case #wm_timer
SetGadgetText(0,Str(ThreadComm\Var))
EndSelect
ForEver
EndIf