WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Boxes Functions
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Box - progress bar


;---------------------------------------------------------------------------------------------
;  udflib.progressbar.wbt
;---------------------------------------------------------------------------------------------
;  by GUI Guy (http://guiguy.wminds.com)
;
;  based on code found on the Winbatch support site long ago - sorry, original credit is unknown

;---------------------------------------------------------------------------------------------
#DefineFunction udfProgressBarCreate(bartype,startx,starty,width,height,step,windowtitle)
;---------------------------------------------------------------------------------------------
;  Creates a progress bar
;  Returns the handle of the progress bar or -1 on failure
;
;   bartype = (4 = vertical, 3 = horizontal )
;   startx = x coordinate of upper left corner of progress bar
;   starty = y coordinate of upper left corner of progress bar
;   width = width of progress bar
;   height = height of progress bar
;   step = how many units to increment on each call to udfProgressBarTick
;   windowtitle = title of window in which to place the progress bar (use "" for main WinBatch window)

dll=strcat(dirwindows(1),"user32.dll")
func="CreateWindowExA"
winclass="msctls_progress32"
hwnd=dllhwnd(windowtitle)
hinst=dllhinst(windowtitle)

smooth= 1
vis= 268435456
child= 1073741824
hProgBar=dllcall(dll,long:func,long:0,lpstr:winclass,lpstr:"",long:bartype | smooth | vis | child,long:startx,long:starty,long:width,long:height,long:hwnd, long:0,long:hinst,long:0)
if !hProgBar then return(-1)
IntControl (22,hProgBar,1028,step,0)
return(hProgBar)
#EndFunction 
;---------------------------------------------------------------------------------------------
#DefineFunction udfProgressBarTick(hProgBar)
;---------------------------------------------------------------------------------------------
;  Increments a progress bar (by amount specified when it was created)
;  Returns 1
;
;   handle = handle of progress bar to increment

IntControl (22,hProgBar,1029,0,0)
return(1)
#EndFunction


BoxesUp("200,200,600,600", @zoomed) 
BoxDrawText(1, "250,250,500,500", "Please wait. Script is processing.", @FALSE, 1)
hProgBar =  udfProgressBarCreate(3,250,400,500,20,10,"")

For x = 1 to 10
  udfProgressBarTick(hProgBar)
  TimeDelay(1)
Next

Article ID:   W15895
File Created: 2004:03:30:15:41:32
Last Updated: 2004:03:30:15:41:32