29/03/2024
Windev et les Api Windows
Nb de visiteurs en ligne : 1
>> Introduction <<
>> Codes et Forum <<
>> Download <<
Rubrique
: 4 - Windows Common Controls
Sujet
: Progress Bar
Auteur
Message
°¨¨ JL ¨¨°
Posté le : 23/06/2000 12:00:00
//La procédure :
//typeb peut être égal à :
// 0 style horizontal normal
// 1 style horizontal en continu
// 4 style vertical normal
// 5 style vertical en continu
// + 0x80000000 pour placer la barre à l'extérieur de la fenêtre
Procédure progressbar( colonneb , ligneb , largeurb , hauteurb , typeb , limiteinf , limitesup , couleurbarre , couleurfond )
initcont est compose de
size est un entier long
typec est un entier long
fin
initcont.size=8
initcont.typec=0x20
hwndbar est un entier long
// vérification si la classe du progressbar existe dans le comctl32.dll
ini est un entier long=appeldll32("comctl32.dll","InitCommonControlsEx",&initcont)
si ini alors
hwndbar=AppelDLL32("user32","CreateWindowExA", 0x20 , "msctls_progress32" , "" , 0x50000000+typeb , colonneb , ligneb , largeurb , hauteurb , handle() , null , instance() , null )
sendmessage( hwndbar , 0x406 , limiteinf , limitesup ) // PBM_SETRANGE32 - fixe les limites
sendmessage( hwndbar , 0x404 , 1 , 0) // PBM_SETSTEP - fixe l'increment
Sendmessage( hwndbar , 0x409 , 0 , couleurbarre ) // couleur barre
sendmessage(hwndbar, 0x2001 , 0 , couleurfond ) // couleur fond
fin
renvoyer hwndbar
//Exemples d'utilisation :
// Affichage dans le bas de la fenêtre
// ************************
limit est un entier long=2000
bar est un entier long=progressbar( 0 , feninthaut()-18 , fenintlarg() , 18 , 0 , 1 , limit+1 , ibleufonce , igrisclair )
ind est un entier long
pour ind=1 a limit
sendmessage( bar , 0x405 , 0 , 0 ) // augmentation barre
si appeldll32("user32","GetInputState") alors multitache(-1)
fin
appeldll32("user32","DestroyWindow",bar)
// Affichage de deux barres dans le bas de la fenêtre
// ***********************************
limit est un entier long=20
limit2 est un entier long=1000
larg est un entier=fenintlarg()/2
bar est un entier long=progressbar( 0 , feninthaut()-18 , larg , 18 , 0 , 1 , limit+1 , ibleufonce , igrisclair )
bar2 est un entier long=progressbar( larg+1 , feninthaut()-18 , larg-1 , 18 , 0 , 1 , limit2+1 , ibleuclair , igrisclair )
ind est un entier long
ind2 est un entier long
pour ind=1 a limit
sendmessage( bar , 0x405 , 0 , 0 )
pour ind2=1 a limit2
sendmessage( bar2 , 0x405 , 0 , 0 )
fin
si appeldll32("user32","GetInputState") alors multitache(-1)
fin
appeldll32("user32","DestroyWindow",bar)
appeldll32("user32","DestroyWindow",bar2)
// Affichage d'une barre extérieure à la fenêtre
// *******************************
limit est un entier long=2000
bar est un entier long=progressbar( {fenencours()}..colonne , {fenencours()}..ligne-20 , {fenencours()}..largeur , 19 , 0x80000000 , 1 , limit+1 , ibleuclair , itransparent )
ind est un entier long
pour ind=1 a limit
sendmessage(bar,0x405,0,0)
si appeldll32("user32","GetInputState") alors multitache(-1)
fin
appeldll32("user32","DestroyWindow",bar)