elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Security Series.XSS. [Cross Site Scripting]


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  [VB6] ProgressBarInListView
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [VB6] ProgressBarInListView  (Leído 2,471 veces)
F3B14N

Desconectado Desconectado

Mensajes: 47


Ver Perfil
[VB6] ProgressBarInListView
« en: 12 Marzo 2011, 14:07 pm »

mProgressBarInListView:
Código
  1. Option Explicit
  2.  
  3. Private Type RECT
  4.    Left    As Long
  5.    Top     As Long
  6.    Right   As Long
  7.    Bottom  As Long
  8. End Type
  9.  
  10. Private Const LVM_FIRST As Long = &H1000
  11. Private Const LVM_GETSUBITEMRECT  As Long = (LVM_FIRST + 56)
  12. Private Const LVIR_LABEL  As Long = 2
  13.  
  14. Private Const WM_NOTIFY  As Long = &H4E
  15. Private Const WM_HSCROLL As Long = &H114
  16. Private Const WM_VSCROLL As Long = &H115
  17. Private Const WM_KEYDOWN As Long = &H100
  18.  
  19. Private Const HDN_FIRST      As Long = (0 - 300)
  20. Private Const HDN_ENDTRACK   As Long = (HDN_FIRST - 1)
  21.  
  22. Private Declare Function SendMessageA Lib "USER32" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  23. Private Declare Function SetParent Lib "USER32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
  24. Private Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
  25.  
  26. Private Declare Function SetWindowLongA Lib "USER32" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  27. Private Declare Function CallWindowProcA Lib "USER32" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  28.  
  29. Private lpPrevWndProc As Long
  30.  
  31. Private Function ListView_GetSubItemRect(ByVal hWndLV As Long, ByVal iItem As Long, ByVal iSubItem As Long, ByVal code As Long, lpRect As RECT) As Boolean
  32.    lpRect.Top = iSubItem
  33.    lpRect.Left = code
  34.    ListView_GetSubItemRect = SendMessageA(hWndLV, LVM_GETSUBITEMRECT, ByVal iItem, lpRect)
  35. End Function
  36.  
  37. Public Sub PutProgressBarInListView(ListView As ListView, InColumn As Long)
  38.    Dim i As Long
  39.  
  40.    For i = 0 To ListView.ListItems.Count - 1
  41.        If i > Form1.ProgressBar1.Count - 1 Then: Call Load(Form1.ProgressBar1(i))
  42.        Call SetParent(Form1.ProgressBar1(i).hWnd, ListView.hWnd)
  43.    Next
  44.  
  45.    Call AdjustProgressBar(ListView, InColumn)
  46.    lpPrevWndProc = SetWindowLongA(ListView.hWnd, -4, AddressOf ListViewProc)
  47. End Sub
  48.  
  49. Public Sub AdjustProgressBar(ListView As ListView, InColumn As Long)
  50.    Dim Pos    As RECT
  51.    Dim i      As Long
  52.  
  53.    For i = 0 To Form1.ProgressBar1.Count - 1
  54.        Call ListView_GetSubItemRect(ListView.hWnd, i, InColumn, LVIR_LABEL, Pos)
  55.        With Form1.ProgressBar1(i)
  56.            .Left = (Pos.Left) * Screen.TwipsPerPixelX
  57.            .Width = (Pos.Right - Pos.Left) * Screen.TwipsPerPixelX
  58.            .Height = ((Pos.Bottom - Pos.Top) * Screen.TwipsPerPixelY)
  59.            .Top = Pos.Top * Screen.TwipsPerPixelY + ((Pos.Bottom - Pos.Top) * Screen.TwipsPerPixelY - .Height) / 2
  60.  
  61.            Call IIf(Pos.Top <= 3, .Visible = False, .Visible = True)
  62.        End With
  63.    Next
  64. End Sub
  65.  
  66. Private Function ListViewProc(ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  67.    Dim Param       As Long
  68.    Dim bAdjust     As Boolean
  69.  
  70.    Select Case Msg
  71.        Case WM_HSCROLL, WM_VSCROLL: bAdjust = True
  72.        Case WM_KEYDOWN
  73.            Select Case wParam
  74.                Case 33 To 40: bAdjust = True
  75.            End Select
  76.        Case WM_NOTIFY
  77.            Call CopyMemory(Param, ByVal lParam + 8, 4)
  78.            If Param = HDN_ENDTRACK Then: bAdjust = True
  79.    End Select
  80.  
  81.    If bAdjust = True Then: Call AdjustProgressBar(Form1.ListView1, 1)
  82.    ListViewProc = CallWindowProcA(lpPrevWndProc, hWnd, Msg, wParam, lParam)
  83. End Function

Simplemente necesitaba hacer esto y lo comparto, espero que le sirva a alguien ;)


En línea

raul338


Desconectado Desconectado

Mensajes: 2.633


La sonrisa es la mejor forma de afrontar las cosas


Ver Perfil WWW
Re: [VB6] ProgressBarInListView
« Respuesta #1 en: 12 Marzo 2011, 14:15 pm »

Funciona :P

Igual tenias este enlace ListViewProgress By LeandroA

:P


En línea

philipjfry99

Desconectado Desconectado

Mensajes: 6


Ver Perfil
Re: [VB6] ProgressBarInListView
« Respuesta #2 en: 19 Marzo 2011, 23:56 pm »

Good work :), for my part i use a non-native LV which can includes directly native progressbar lol
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines