Hi!

I have a progressbar on my form, and have put it in a statusbar's panel of my form with this code:

Code:
    ShowProgressInStatusBar StatusBar, MainProgressBar, 2
Wich in turn calls this sub:

Code:
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)

Public Sub ShowProgressInStatusBar(StatBar As StatusBar, ProgrBar As ProgressBar, Panl As Integer)

    Dim tRC As RECT

    SendMessageAny StatBar.hwnd, SB_GETRECT, Panl - 1, tRC
    With tRC
        .Top = (.Top * Screen.TwipsPerPixelY)
        .Left = (.Left * Screen.TwipsPerPixelX)
        .Bottom = (.Bottom * Screen.TwipsPerPixelY) - .Top
        .Right = (.Right * Screen.TwipsPerPixelX) - .Left
    End With
    ' Re-parent the ProgressBar to the statusbar
    With ProgrBar
        SetParent .hwnd, StatBar.hwnd
        .Move tRC.Left, tRC.Top, tRC.Right, tRC.Bottom
        .Visible = True
        .Value = 0
    End With
End Sub
In my form_resize I use this code:

Code:
MainProgressBar.Left = StatusBar.Panels(2).Left
Problem is when I maximize my form, the progressbar doesn't change it's position (size doesn't have to). I think it's because the Statusbar gets it's resize event AFTER the form_resize has finished.

Anyone got any clue on how to solve it? I'd like not to have to use some timer or so... Maybe subclassing? Please help? How do I know when the Statusbar has finished sizing?