[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

VB6 -- is there a limit on the number of events that can be queued up?

Posted on 2009-07-10
6
Medium Priority
?
356 Views
Last Modified: 2013-12-04
Consider a complex form in VB6 that has LOTS and LOTS of buttons, dropdowns, etc, some of them kicking off data access calls, and therefore requiring some time (500 ms?) to complete.

It would be possible for the user to kick one of the data-intense processes, then click a bunch more things in that form while the data process caught up.

What would happen?

Is there a limit to the number of those events (not just clicks, but events caused by internal stuff too) which can be kept queued up?

And if the user exceeded this limit ... what would happen?

Would this cause the program to crash without a visible error message?

Thanks for any insight ...
0
Comment
Question by:Daniel Wilson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 10

Accepted Solution

by:
peetm earned 1200 total points
ID: 24829639
I believe RaiseEvent is synchronous - so I think we're only talking about events on the UI, and timers, dde, ... here, i.e., queued Windows' Messages, which are translated to VB events?

I don't believe there's a way to query the OS about this, and so you'd have to empirically derive the necessary value ... I should think this will get you somewhere close ...

Private Declare Function PostMessage Lib "user32.dll" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_MOUSEMOVE As Long = &H200

Private Sub Command1_Click()

    Dim l As Long

    Do While PostMessage(Me.hwnd, WM_MOUSEMOVE, 0, 0)
   
        l = l + 1
   
    Loop

    Debug.Print l

End Sub

I'll let you run that to see the output - which I found to be surprisingly large!



0
 
LVL 32

Author Comment

by:Daniel Wilson
ID: 24829994
hmm ... 10,000.

Even with multiple grids and data sources ... I don't think we're hitting that figure.

Thanks!
0
 
LVL 5

Assisted Solution

by:BrianVSoft
BrianVSoft earned 400 total points
ID: 24829999
That situation is normal to most business forms..
Normally windows doesn't allow any new "Click" to run until the previous process has finished.
If you have long processes, it is normal to allow "User Cancel" options which require the inclusion of the infamous DoEvents statement..
DoEvents will allow the user to Click start other processes..
In any case, It is normal to simply control these processes via a public variable Eg Processing as Boolean
Ie.
Sub Button99_Click
 If Processing then Beep : Exit Sub
 LabelBusy.Visible = True
 Processing = True
   code:::::
 LabelBusy.Visible = False
 Processing = False
End Sub
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 10

Expert Comment

by:peetm
ID: 24830421
It's also possibly the case [as this is undocumented as far as I know] that the 'queue space' is a fixed size, i.e., you'll queue less messages that carry with them heavy data structures - one of the reasons that this is usually 'done' via carrying a fixed-sized pointer.
0
 
LVL 46

Assisted Solution

by:aikimark
aikimark earned 400 total points
ID: 24854500
With this description, I think you are facing a choice between restructuring and managing user expectations.  The later is much simpler...when the user clicks on a control that is associated with a (potentially) long running process, then do the following in that control:

Private Sub cmdGetData()
  Me.MousePointer = vbHourglass
  Me.Enabled = False
  'do the button click work here
 
  Me.Enabled = True
  Me.MousePointer = vbDefault
 
End Sub

Open in new window

0
 
LVL 32

Author Comment

by:Daniel Wilson
ID: 24878923
OK, I think I got this solved by disabling some buttons during long-running operations.  Thanks, everyone!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question