
VB apps that run in bkgrnd, DoEvents Qs
Hi All,
I have written a VB4 Pro 16-bit app that runs in the background and
tracks app usage for charging to clients and managing the network.
The program works well and my company likes it, but often slows down
the PC noticeably, and I can't help thinking it could be better (no
programmer ever really finishes writing a program, do they?).
Does anyone have experience, suggestions, or whatever for VB apps that
run continuously in the background? Simply adding more DoEvents does
not seem to change overall performance, is there a better way?
Please avoid any temptation to suggest re-writing it in C, the company
wants it in VB.
Here is a simplified version of the code that runs in the
background...
Still_Sleeping:
If MyApp.WindowState <> 1 Then
...user set focus to my app so wake up
End if
DoEvents
H% = getactivewindow()
ActualApp$ = UCase$(ExeName(H%))
If ActualApp$ = CurrentApp$ Then GoTo Still_Sleeping
...Check for screen saver (which is not chargeable)
...if screen saver then loop
...Check app name to determine if new app is chargeable
...take appropriate action then loop
Thanks in advance for any suggestions.
-Mark