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
Solved

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

Posted on 2009-07-10
6
342 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
6 Comments
 
LVL 10

Accepted Solution

by:
peetm earned 300 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 100 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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 45

Assisted Solution

by:aikimark
aikimark earned 100 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
message box in access 4 51
Access Object Property from VBA Module in Excel 2010 2 37
Please explain "Multi-Tenant Services" 5 99
SSRS troubles 4 68
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

809 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