Results 1 to 2 of 2

Thread: StatusBars.....

  1. #1

    Thread Starter
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765

    StatusBars.....

    I'm trying to make a StatusBar for my WebBrowser, similar 2 IE. Does anyone know how to make a StatusBar that has how far the download is completed and still act like IE, which has the link Url and and mouseover text.
    Can anyone help??

  2. #2
    Frenzied Member Mega_Man's Avatar
    Join Date
    Mar 2001
    Location
    North of England, South-East of Iceland
    Posts
    1,067
    VB Code:
    1. Private Declare Function SetParent Lib "user32" (ByVal hWndChild As _
    2. Long, ByVal hWndNewParent As Long) As Long
    3. Private Declare Function SendMessageAny Lib "user32" Alias "SendMessageA" _
    4. (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, lParam _
    5. As Any) As Long
    6.  
    7. '
    8. ' API Types
    9. '
    10. ' RECT is used to get the size of the panel we're inserting into
    11. '
    12. Private Type RECT
    13.     Left As Long
    14.     Top As Long
    15.     Right As Long
    16.     Bottom As Long
    17. End Type
    18.  
    19. '
    20. ' API Messages
    21. '
    22. Private Const WM_USER As Long = &H400
    23. Private Const SB_GETRECT As Long = (WM_USER + 10)
    24.  
    25.  
    26. Private Sub ShowProgressInStatusBar(ByVal bShowProgressBar As Boolean)
    27.  
    28.     Dim tRC As RECT
    29.  
    30.     If bShowProgressBar Then
    31.         '
    32.         ' Get the size of the Panel (2) Rectangle from the status bar
    33.         ' remember that Indexes in the API are always 0 based (well,
    34.         ' nearly always) - therefore Panel(2) = Panel(1) to the api
    35.         '
    36.         '
    37.         SendMessageAny StatusBar1.hwnd, SB_GETRECT, 1, tRC
    38.         '
    39.         ' and convert it to twips....
    40.         '
    41.         With tRC
    42.             .Top = (.Top * Screen.TwipsPerPixelY)
    43.             .Left = (.Left * Screen.TwipsPerPixelX)
    44.             .Bottom = (.Bottom * Screen.TwipsPerPixelY) - .Top
    45.             .Right = (.Right * Screen.TwipsPerPixelX) - .Left
    46.         End With
    47.         '
    48.         ' Now Reparent the ProgressBar to the statusbar
    49.         '
    50.         With ProgressBar1
    51.             SetParent .hwnd, StatusBar1.hwnd
    52.             .Move tRC.Left, tRC.Top, tRC.Right, tRC.Bottom
    53.             .Visible = True
    54.             .Value = 0
    55.         End With
    56.  
    57.     Else
    58.         '
    59.         ' Reparent the progress bar back to the form and hide it
    60.         '
    61.         SetParent ProgressBar1.hwnd, Me.hwnd
    62.         ProgressBar1.Visible = False
    63.     End If
    64.  
    65. End Sub
    66.  
    67. Private Sub Command1_Click()
    68.     'Call the function
    69.     Call ShowProgressInStatusBar(True)
    70.    
    71.     'Do something in the progress bar
    72.     For i = 1 To ProgressBar1.Max
    73.         ProgressBar1.Value = i
    74.     Next i
    75.  
    76. End Sub
    Not sure how you get the progress of a page though. Sorry
    "If at first you don't succeed, then skydiving is not for you"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width