|
-
Oct 11th, 2001, 03:55 AM
#1
Thread Starter
PowerPoster
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
-
Oct 11th, 2001, 04:09 AM
#2
PowerPoster
Are you putting DoEvents after ever progressbar value update?
-
Oct 11th, 2001, 04:14 AM
#3
Thread Starter
PowerPoster
-
Oct 11th, 2001, 04:30 AM
#4
Thread Starter
PowerPoster
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
-
Oct 12th, 2001, 08:41 AM
#5
Thread Starter
PowerPoster
Anyone
-
Oct 12th, 2001, 08:57 AM
#6
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
-
Oct 12th, 2001, 09:18 AM
#7
Thread Starter
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|