Lopende voortgangsbalk (rolling progressbar)

Alles over het toepassen van API en DLL's in Liberty BASIC

Moderator: anthonio

Lopende voortgangsbalk (rolling progressbar)

Berichtdoor anthonio » wo aug 27, 2008 5:32 pm

Heb dit van het LB.com forum.
Kan altijd van pas komen.

Code: Selecteer alles
     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

Dual boot: Ubuntu 8.04 - WIndows XP SP2 (via VMware) - Windows Vista 32bit - Toshiba L40 - Dual Core @ 1,76GHz - 1GB RAM - 120GB HDD - VDSL Connection
Avatar gebruiker
anthonio
 
Berichten: 281
Geregistreerd: zo mei 20, 2007 9:58 pm

Keer terug naar API/DLL

Wie is er online

Gebruikers op dit forum: Geen geregistreerde gebruikers. en 2 gasten

cron