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

Dialog Editor version 6.X
plus
plus

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

Add a Status Bar to your Dialog

Keywords: 	 Add a Status Bar Dialog

This control gives you a Status Bar on your dialog. And alows you to change the text.
Styles:
CCS_TOP = 1 ; Pass to Create to put the bar on the top of the windows
SBT_POPOUT = 512 ; Pass to SetText to make the text 'pop out'
SBT_NOBORDERS = 256 ; Pass to SetText to not put borders round the text

#definefunction StatusBarCreate(style,handle)
  user32=strcat(dirwindows(1),"user32.dll")
  hinst=dllhinst("")
  Return dllcall(user32,long:"CreateWindowExA",long:512,lpstr:"msctls_statusbar32",lpstr:"",long:1073741824|268435456|style,long:0,long:0,long:0,long:0,long:handle,long:0,long:hinst,long:0)
#endfunction

;------------------------------------------------------------------------------;
;TEST                                                                          ;
;------------------------------------------------------------------------------;
#definesubroutine dlgproc(handle,msg,id,p4,p5)
select msg
  case 0 ;Init
    DialogProcOptions(handle,2,1) ;BUTTONS
    ;constants
    user32=strcat(dirwindows(1),"user32.dll")
    WM_USER=1024
    SB_SETPARTS=WM_USER+4
    SB_SETTEXT=WM_USER+1

    ;create status
    hstat=StatusBarCreate(0,handle)

    ;array of widths 3 parts * 4 bytes each=12 bytes
    awidths=binaryalloc(12)
    binarypoke4(awidths,0,60)
    binarypoke4(awidths,4,120)
    binarypoke4(awidths,8,-1)

    dllcall(user32,long:"SendMessageA",long:hstat,long:SB_SETPARTS,long:3,lpbinary:awidths)

    ;set text
    dllcall(user32,long:"SendMessageA",long:hstat,long:SB_SETTEXT,long:0,lpstr:"Text1")
    dllcall(user32,long:"SendMessageA",long:hstat,long:SB_SETTEXT,long:1,lpstr:"Text2")
    dllcall(user32,long:"SendMessageA",long:hstat,long:SB_SETTEXT,long:2,lpstr:"Text3")
    
    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=`Status Bar`
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:   W15451
File Created: 2003:05:13:11:28:04
Last Updated: 2003:05:13:11:28:04