Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "win32api.inc"
#Resource "status.pbr"
%ID_Timer = 500
%IDC_Start = 600
%IDC_End = 601
Global hDlg,hThread As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "Toolbar Test",400,400,200,100, %WS_OverlappedWindow To hDlg
Dialog Set Icon hDlg, "main"
Control Add Button, hDlg, %IDC_Start, "Start Timer", 10,10,50,20
Control Add Button, hDlg, %IDC_End, "End Timer", 70,10,50,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Start : Thread Create StartTimer(0) To hThread : Thread Close hThread To hThread
Case %IDC_End : KillTimer hDlg, %ID_Timer
End Select
Case %WM_Timer
Static iImage As Long
Incr iImage : If iImage > 30 Then iImage = 1
Dialog Set Icon hDlg, "#"+Trim$(Str$(iImage))
End Select
End Function
Thread Function StartTimer(ByVal x As Long) As Long
SetTimer(hDlg, %ID_Timer, 50&, %NULL) 'sends %WM_Timer to dialog callback
End Function
'gbs_00718
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm