Sver
Full Member
Posts: 145
|
Post by Sver on Nov 25, 2023 8:48:16 GMT -5
Global PBM.SETSTUP : PBM.SETSTEP = 1028 Global PBM.STEPIT : PBM.STEPIT = 1029 Global PBM.SETPOS : PBM.SETPOS = (_WM_USER)+2
BackgroundColor$ = "Black" WindowWidth = 250 WindowHeight = 150 open "window" for window as #1 #1, "trapclose [quitR]" hWnd = hWnd(#1) hProg = CreateProgressBar(hWnd, 20, 60, 200, 25)
[Repeat] timer 0 For i = 0 to 100 timer 100, [Next] wait
[Next] timer 0 call SetPos hProg, i print i next i wait [quitR] close #1 end
'Progressbar function
Function CreateProgressBar(hWnd, x, y, w, h) extStyle = _WS_EX_CLIENTEDGE progStyle = _WS_CHILD or _WS_VISIBLE
CallDLL #user32, "CreateWindowExA", _ extStyle as long,_ "msctls_progress32" as ptr,_ "" as ptr,_ progStyle as long,_ x as long,_ y as long,_ w as long,_ h as long,_ hWnd as long,_ 0 as long,_ hInst as long,_ CreateProgressBar as long End Function
Sub SetPos hProg, num CallDLL #user32, "SendMessageA",_ hProg as long,_ PBM.SETPOS as long,_ num as long,_ 0 as long,_ ret as long End Sub
|
|
Sver
Full Member
Posts: 145
|
Post by Sver on Nov 25, 2023 8:57:52 GMT -5
nomainwin WindowWidth = 300 WindowHeight = 80 UpperLeftX=int((DisplayWidth-WindowWidth)/2) UpperLeftY=int((DisplayHeight-WindowHeight)/2)
stylebits #splash.g, 0, _WS_BORDER,0, 0 stylebits #splash, 0 ,0,_EDGE_BUMP , 0
open "Welcome" for window_popup as #splash #splash,"trapclose [Quit]"
hwndPB=createProgressBar(hWnd(#splash))
timer 7000, [Quit] wait [Quit] timer 0 close #splash end
FUNCTION createControl(extended,class$,title$,style,left,top,width,height,hParent,pInst) calldll #user32, "CreateWindowExA" , _ extended as long , _ class$ as ptr , _ title$ as ptr , _ style as long , _ left as long , _ top as long , _ width as long , _ height as long , _ hParent as ulong , _ 0 as long , _ pInst as ulong , _ 0 as long , _ createControl as ulong END FUNCTION
FUNCTION createProgressBar(hWnd) PBM.SETMARQUEE =_WM_USER+10 hInst=getWindowLong(hWnd, _GWL_HINSTANCE)
style = _WS_CHILD or _WS_VISIBLE or PBM.SETMARQUEE 'de cijfers na de style zijn x-pos, y-pos, x-width, y-width createProgressBar= createControl(0,"msctls_progress32","",style,50,30,200,20,hWnd,hInst) call sendMessage createProgressBar,PBM.SETMARQUEE,1 ,100 END FUNCTION
FUNCTION getWindowLong(hWnd, type) CallDLL #user32, "GetWindowLongA",_ hWnd as uLong, _ type as Long, _ getWindowLong as uLong END FUNCTION
SUB sendMessage hWnd,message,wParm ,lParm calldll #user32, "SendMessageA",_ hWnd as ulong,_ message as long,_ wParm as long,_ lParm as long,_ r as long END SUB
|
|
|
Post by tsh73 on Nov 25, 2023 11:36:42 GMT -5
Last one does not actually shows progress. It is kind of "idle animation", if moves but it does not make feeling of visible progress.
|
|