Results 1 to 7 of 7

Thread: ProgressBar Api

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288

    ProgressBar Api

    I an using the Progressbar supplied with Windows Common
    Controls. I would like to update it through api calls using SendMessage, not through the inbuilt functions, as I have to update it from various places.
    The problem is that it is not responding to the api calls. Once in a while it might respond and increase the value. I know this might sound strange, but this is happening.

    Thanks

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Are you putting DoEvents after ever progressbar value update?

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Yes, tried that.

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    I am using this code:
    Code:
    Option Explicit
    
    Private Const WM_USER = &H400
    Private Const CCM_FIRST = &H2000
    Private Const CCM_SETBKCOLOR = (CCM_FIRST + 1)
    Private Const PBM_DELTAPOS = (WM_USER + 3)
    Private Const PBM_GETPOS = (WM_USER + 8)
    Private Const PBM_GETRANGE = (WM_USER + 7)
    Private Const PBM_SETBARCOLOR = (WM_USER + 9)
    Private Const PBM_SETBKCOLOR = CCM_SETBKCOLOR
    Private Const PBM_SETPOS = (WM_USER + 2)
    Private Const PBM_SETRANGE = (WM_USER + 1)
    Private Const PBM_SETRANGE32 = (WM_USER + 6)
    Private Const PBM_SETSTEP = (WM_USER + 4)
    Private Const PBM_STEPIT = (WM_USER + 5)
    Private Const PBS_SMOOTH = &H1
    
    
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
    lParam As Any) As Long
    
    Private Sub Command1_Click()
    Dim lngRV As Long
    Dim i As Integer
        While i < 1000
            'lngRV = SendMessage(ProgressBar1.hwnd, PBM_SETPOS, 10&, 0&)
            lngRV = SendMessage(ProgressBar1.hwnd, PBM_SETSTEP, 10&, 0&)
            lngRV = SendMessage(ProgressBar1.hwnd, PBM_STEPIT, 0&, 0&)
            i = i + 1
        Wend
        i = 0
    End Sub

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Anyone

  6. #6
    jim mcnamara
    Guest
    Is the progress bar nested inside several containers? Do these containers have controls that are doing things like a textbox getting updated from a big textfile or db ie., loads of message traffic.

    You can see that message queuing is getting bogged down:

    Subclass the messages being sent to the prog bar. Check on the messages it is receiving. I think you'll find the messages are getting there, just really late. You've queue contention

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    I will try subclassing, but the above code is only one that I have on my form. Nothing else is being executed.

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