Okay, a complete and total utter hack in which I set up a timer to monitor the timer created by Windows in order to complete the painting of the progressbar!

We are snooping upon the snooper!
If this doesn't run in other versions of Windows then you'll need some conditional code to take account of this.
Code: Select all
Global oldProc, progressFlag
Procedure progressCallback(hWnd, uMsg, wParam, lParam)
Protected result = CallWindowProc_(oldProc, hWnd, uMsg, wParam, lParam)
Static count
Select uMsg
Case #WM_PAINT
If GetGadgetState(0) = 200
;Create a timer to monitor the 'other' timer!
SetTimer_(hWnd, 100, 10, 0)
EndIf
Case #WM_TIMER
If wParam = 100 ;This is our timer.
count+1 ;A count of the number of times this timer is called consecutively.
Else
count=0
EndIf
If count = 10 ;Should be enough to determine that the 'other' timer has completed. Increase this value if you get problems.
KillTimer_(hWnd, 100)
count = 0
HideGadget(0,1)
HideGadget(1,0)
EndIf
EndSelect
ProcedureReturn result
EndProcedure
Procedure addtolist()
For n2=0 To 150
AddGadgetItem(1,-1,Str(Random(10000)))
Next n2
EndProcedure
If OpenWindow(0, 0, 0, 600, 100, "ProgressBarGadget Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
ListIconGadget(1,10,10,580,80,"",100)
ProgressBarGadget(0, 10, 40, 580, 20, 0, 200)
oldProc = SetWindowLong_(GadgetID(0), #GWL_WNDPROC, @progressCallback())
HideGadget(1,1)
For n=0 To 200
addtolist()
SetGadgetState(0,n)
Next n
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
I may look like a mule, but I'm not a complete ass.