una imagen de ejemplo

agregar un progressbar1 (de la version Common Controls 5)
Código:
Option Explicit
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const GWL_STYLE = (-16)
Private Const WM_USER As Long = &H400
Private Const PBS_MARQUEE As Long = 8
Private Const PBM_SETMARQUEE = (WM_USER + 10)
Private Sub Form_Load()
Dim Ret As Long
Ret = SetStyleMarquee(ProgressBar1.hwnd, 50)
If Ret = False Then
MsgBox "No se pudo aplicar el estilo"
End If
End Sub
Public Function SetStyleMarquee(hwnd As Long, Velocity As Long) As Boolean
SetWindowLong hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) Or PBS_MARQUEE
SetStyleMarquee = SendMessageLong(hwnd, PBM_SETMARQUEE, 1, Velocity)
End Function
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const GWL_STYLE = (-16)
Private Const WM_USER As Long = &H400
Private Const PBS_MARQUEE As Long = 8
Private Const PBM_SETMARQUEE = (WM_USER + 10)
Private Sub Form_Load()
Dim Ret As Long
Ret = SetStyleMarquee(ProgressBar1.hwnd, 50)
If Ret = False Then
MsgBox "No se pudo aplicar el estilo"
End If
End Sub
Public Function SetStyleMarquee(hwnd As Long, Velocity As Long) As Boolean
SetWindowLong hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) Or PBS_MARQUEE
SetStyleMarquee = SendMessageLong(hwnd, PBM_SETMARQUEE, 1, Velocity)
End Function
Lo compilan y agregan un archivo Proyecto1.exe.manifest junto al ejecutable, sino no funciona.
Me han dicho que con algunos themes de windows no funciona. aver que les pasa a ustedes.










Autor





En línea



