?
Solved

How vb6 Handles Multiple Events ?

Posted on 2003-03-05
3
Medium Priority
?
596 Views
Last Modified: 2012-06-27
Hi,

I would like to have multiple(about 6-10)MSCOMM controls
created at design time as a control array.

so we have only one event handler.

The events are generated asynchronously according to the
data on the ports(not very often probably every 1-2
seconds ).

My question is how does vb handle multiple events that are
generated. Are some events lost if not handled very soon.
How many events can the windows OS & VB hold so that some
events are not lost?

Thanks
kodela

0
Comment
Question by:prakrithk
[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
3 Comments
 
LVL 4

Assisted Solution

by:RanaHossain
RanaHossain earned 150 total points
ID: 8078124
Hi Kodela,

I am writing a POP3 checker for my IIS server, which now uses upto 10 threads to check E-mail. Now with no e-mails, it takes about 1.3 seconds to check 8 e-mails..

So I guess what I am trying to say is, each thread has about 3 external events, which raises some more.. so if you are thinking one event every 1-2 seconds .. should be fine.
0
 
LVL 6

Accepted Solution

by:
marconovaro earned 450 total points
ID: 8078337

Hi Kodela,

the events are managed in a synchronous way. That is, the full event code is executed, before "listening to" a new event. This means that you should not have problems. Furthermore, 1-2 seconds is not so much (you should execute the full code in some microseconds).

UNLESS you are going to use DoEvents in the MSComm_OnComm event: do not do this! This is because if you use DoEvents, you could receive again the same event, and enter a recursive loop, that could cause you bad errors (out of stack space).

If you fear not to cope with the speed of the upcoming events, do something like this:

- in the OnComm event, read the buffer and put it into a FIFO
- set a timer, and parse the FIFO buffer there.

This will "separate" the incoming events from the time you need to parse them


Hope this helps.
M
0
 

Expert Comment

by:CleanupPing
ID: 8900599
prakrithk:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
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…
Suggested Courses
Course of the Month10 days, 16 hours left to enroll

770 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