Date: 02-16-2022
Return to Index
created by gbSnippets
'An online ProgressBar control tutorial may be found at:
'http://www.garybeene.com/power/pb-tutor-controls.htm
'Primary Code:
'Syntax: Control Add ProgressBar, hDlg, id&, txt$, x, y, xx, yy [, [style&] [, [exstyle&]]] [[,] Call CallBack]
Control Add ProgressBar, hDlg, 100,"", 50,50,100,20
'Compilable Example: (Jose Includes)
'The following compilable code demonstrates a dialog with a ProgressBar control.
'It includes a timer to create progressbar action.
'Controls can also have a Callback function of their own.
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg As Dword
Function PBMain() As Long
Dialog New Pixels, 0, "ProgressBar Test",300,300,200,200, %WS_SysMenu, 0 To hDlg
Control Add ProgressBar, hDlg, 100,"", 50,50,100,20
ProgressBar Set Pos hDlg, 100, 80
Control Set Color hDlg, 100, %Red, %Blue
Dialog Show Modal hDlg, Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case CB.Msg
Case %WM_InitDialog 'sent just before Dialog is displayed
SetTimer CB.Hndl, 200, 350, ByVal %NULL
Case %WM_Timer
Static i as Long
i = i + 10
If i > 100 Then i = 0
ProgressBar Set Pos hDlg, 100, i
Case %WM_Destroy 'sent when dialog is being destroyed
KillTimer CB.Hndl, 200
End Select
End Function
'gbs_00099
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm