Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: UDFs to make a Progress Bar control
PBS_SMOOTH = 1 PBS_VERTICAL = 4 #definefunction BarCreate(x,y,w,h,style,handle) user32=strcat(dirwindows(1),"user32.dll") hinst=dllhinst("") Return dllcall(user32,long:"CreateWindowExA",long:512,lpstr:"msctls_progress32",lpstr:"",long:1073741824|268435456|style,long:x,long:y,long:w,long:h,long:handle,long:0,long:hinst,long:0) #endfunction #definefunction BarGetPos(handle) WM_USER = 1024 PBM_GETPOS = WM_USER + 8 user32=strcat(dirwindows(1),"user32.dll") Return dllcall(user32,long:"SendMessageA",long:handle,long:PBM_GETPOS,long:0,long:0) #EndFunction #definefunction BarSetPos(handle,position) WM_USER = 1024 PBM_SETPOS = WM_USER + 2 user32=strcat(dirwindows(1),"user32.dll") Return dllcall(user32,long:"SendMessageA",long:handle,long:PBM_SETPOS,long:position,long:0) #EndFunction #definefunction BarGetPos(handle,position) WM_USER = 1024 PBM_GETPOS = WM_USER + 8 user32=strcat(dirwindows(1),"user32.dll") Return dllcall(user32,long:"SendMessageA",long:handle,long:PBM_GETPOS,long:0,long:0) #EndFunction #definefunction BarSetRange(handle,low,high) WM_USER = 1024 PBM_SETRANGE32 = WM_USER + 6 user32=strcat(dirwindows(1),"user32.dll") RANGE=binaryalloc(8) binarypoke4(RANGE,0,low) binarypoke4(RANGE,4,high) val = dllcall(user32,long:"SendMessageA",long:handle,long:PBM_SETRANGE32,long:low,long:high) binaryfree(RANGE) Return val #EndFunction #definefunction BarSetStep(handle,step) WM_USER = 1024 PBM_SETSTEP = WM_USER + 4 user32=strcat(dirwindows(1),"user32.dll") val = dllcall(user32,long:"SendMessageA",long:handle,long:PBM_SETSTEP,long:step,long:0) Return val #EndFunction #definefunction BarStepIt(handle) WM_USER = 1024 PBM_STEPIT = WM_USER + 5 user32=strcat(dirwindows(1),"user32.dll") val = dllcall(user32,long:"SendMessageA",long:handle,long:PBM_STEPIT,long:0,long:0) Return val #EndFunction #definefunction BarSetBarColour(handle,colour) WM_USER = 1024 PBM_SETBARCOLOR = WM_USER + 9 user32=strcat(dirwindows(1),"user32.dll") val = dllcall(user32,long:"SendMessageA",long:handle,long:PBM_SETBARCOLOR,long:0,long:colour) Return val #EndFunction #DefineFunction SetColour(red,green,blue) Return ((red mod 256)+(green mod 256)*256+(blue mod 256)*256*256) #EndFunction ;------------------------------------------------------------------------------; ;TEST ; ;------------------------------------------------------------------------------; #definesubroutine dlgproc(handle,msg,id,p4,p5) select msg case 0 ;Init DialogProcOptions(handle,2,1) ;BUTTONS DialogProcOptions(handle,1,100) ; TIMER ;create treeview htree=BarCreate(10,30,200,20,PBS_SMOOTH,handle) user32=strcat(dirwindows(1),"user32.dll") BarSetRange(htree,0,200) BarSetStep(htree,10) break Case 1 ;Timer BarStepIt(htree) If BarGetPos(htree) == 160 then BarSetBarColour(htree,SetColour(200,0,0)) Else If BarGetPos(htree) < 20 Then BarSetBarColour(htree,SetColour(0,200,0)) EndIf break case 2 ;Button pushed select id case 1 ;Ok get item return -2 case 0 ;exit return -1 endselect endselect return -1 #endsubroutine MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption=`Tree Control` MyDialogX=-01 MyDialogY=-01 MyDialogWidth=120 MyDialogHeight=150 MyDialogNumControls=002 MyDialogProcedure=`dlgproc` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialogConfig=0 MyDialog001=`009,111,036,012,PUSHBUTTON,DEFAULT,"OK",1,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`071,111,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("MyDialog",1)
Article ID: W15470
File Created: 2003:05:13:11:28:06
Last Updated: 2003:05:13:11:28:06