I have an old VB6 application that has a timer issue. There is a modal form that contains some elements and two timers (VB6 standard timers). Each timer works like this (pseudo code):
-- TimerEvent Start
DoSomething
DoEvents
-- TimerEvent End
Then, at some point in time, an event from an OCX control is raised that some connection is lost. Is has nothing to do with the timer itself. But at this point, the timer event is not raised anymore for both timers although - now the weird stuff - the timers are enabled and have an interval of 2000 set. Even re-enabling and re-setting the interval does not have any effect. When another event from the same OCX control is raised that the connection was restored, the timer event is suddenly raised again. Even if removing all the code in the OCX control event handlers, the timers are not working.
I am not very familiar with the DoEvents "pattern" but I assume the issue must be related with the DoEvents. Removing this did not change anything.
Has anyone an idea what could happen here? I already looked for any global setting that would prevent the timer from raising the elapsed event but for god's sake I couldn't find any.
I am going crazy on this...
Thank you for any help.
GetMessage()somewhere and consuming your timer event. I suspect, but don't know for sure, that the VB6 timer just uses WM_TIMER underneath. Maybe the OCX, which by the sound of it is a networking library or so, uses a WM_TIMER for its timeout internally, and incorrectly interprets the VB6 timer's message as its own timeout message. - pmdj