Io ho questo codice che dà impulso ad una progressbar che viene caricata in basso nella status bar. Io vorrei solo che non venga caricata nella status bar come nel codice che segue. Potreste correggermelo?
Option Explicit
Dim Action As String
Dim WinState As Integer
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function SendMessageAny Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Const WM_USER As Long = &H400
Private Const SB_GETRECT As Long = (WM_USER + 10)
Private Sub ShowProgressInStatusBar(ByVal ShowBar As Boolean)
Dim tRC As RECT
If ShowBar Then
SendMessageAny StatusBar1.hwnd, SB_GETRECT, 2, tRC
With tRC
.Top = (.Top * Screen.TwipsPerPixelY)
.Left = (.Left * Screen.TwipsPerPixelX)
.Bottom = (.Bottom * Screen.TwipsPerPixelY) - .Top
.Right = (.Right * Screen.TwipsPerPixelX) - .Left
End With
With ProgressBar1
SetParent .hwnd, StatusBar1.hwnd
.Move tRC.Left, tRC.Top, tRC.Right, tRC.Bottom
.Visible = True
.Value = 0
End With
Else
SetParent ProgressBar1.hwnd, hwnd
ProgressBar1.Visible = False
End If
End Sub
Private Sub Command1_Click()
ShowProgressInStatusBar True
Dim i As Integer
For i = 1 To ProgressBar1.Max
ProgressBar1.Value = i
Next
End Sub
Ciao
Adrix![]()