un exemple simplifié de mon code.
Code : Tout sélectionner
EnableExplicit
Enumeration
#MainForm
#ProgressForm
#Progress
EndEnumeration
Define WindowEvent
;Affichage de la boite de dialogue de progression
Procedure ShowProgress()
OpenWindow(#ProgressForm, 0, 0, 200, 100, "", #PB_Window_ScreenCentered, WindowID(#Mainform))
ProgressBarGadget(#Progress, 5, 40, 190, 20, 0, 100)
EndProcedure
;Le thread
Procedure Count(Value)
Protected i.i
For i=1 To 1000
SetGadgetState(#Progress, i/10)
Next
CloseWindow(#ProgressForm) ;<== aucun effet
EndProcedure
If OpenWindow(0, 0, 0, 300, 300, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ShowProgress()
CreateThread(@Count(), #Null)
Repeat
WindowEvent = WaitWindowEvent()
Select WindowEvent
Case #PB_Event_CloseWindow
End
EndSelect
ForEver
EndIf