Detect event in VB6 program

I have a VB6 application that need almost 100% of cpu time. If I include a DoEvents in my program loop then this will desturb the outputs from my program.
Is it possible to check for a command button event, or something to make it possible to terminate my program loop.
The problem is that DoEvents take to long time.
sekAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
clavrgConnect With a Mentor Commented:
If you want to use event from command button you have to dispatch a window's message queue. Simplest way to do so is to use GetMessage (WinAPI) and DispatchMessage(WinAPI) you can try to play around with parameters of these functions in order to speed up this process. DoEvents do the same, I do not know whether you going to gain any improvement if you do it manually. I would try to change process' priority class to (e.g. to real-time) and call DoEvents as seldom as possible. I.e. you do not need to check message queue 100s times a second. 1 time a second should be enough.

Maybe you can think on this idea.
Instead of getting event from command button. You can show message smth like "Press and hold Ctrl key to interupt execution". And then check status of the keyboard. I do not know how to do so. Just note that if you will call "GetKeyStat" (WinAPI) will not work since this function also relies on the message queue.
0
 
CleanupPingCommented:
sek:
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
All Courses

From novice to tech pro — start learning today.