P
Peter Oliphant
YEAH! Indeed, everyone in this newsgroup pointed (ok pushed..hehe) me into
the right direction.
If I use this Timer:
System::Timers::Timer it all works.
If I use:
System::Windows::Form::Timer it doesn't.
Only difference in implementation is one uses a Tick event the other an
Elapsed event (and corresponding different event hadler forms ala different
argument types). Mixing managed and unmanaged can have some unpredictable
side-effects!
And I think this might solve another problem I just realized could be
related!
Thanx everyone. It works now...
[==Peter==]
the right direction.
If I use this Timer:
System::Timers::Timer it all works.
If I use:
System::Windows::Form::Timer it doesn't.
Only difference in implementation is one uses a Tick event the other an
Elapsed event (and corresponding different event hadler forms ala different
argument types). Mixing managed and unmanaged can have some unpredictable
side-effects!
And I think this might solve another problem I just realized could be
related!
Thanx everyone. It works now...
[==Peter==]
Peter Oliphant said:I've been using System::Windows::Forms::Timer, which doesn't have an
'InvokeRequired' property.
I'm thinking I'm using the wrong Timer class. I'll look for others in
MSDN. Not sure how to look up different classes with the same name though.
The one I use isn't managed. I'd rather use a managed one, as long as it
can have an Interval in milliseconds, a means to turn it on and off, and a
way to give it an event handler (hopefully via delegates).
Not sure that has anything to do with it, but it could...
[==Peter==]
Ben Voigt said:Peter Oliphant said:What if you enable the Timer before starting recognition? Do ticks
stop arriving when you enable the recognition engine?
The Timer runs fine unless I try to use it in the event handler. That
is, any running Timer is not effected by the recognition event handler
firing, but trying to do something with a Timer inside such a handler
does.
Could your tick handler check a shared variable and immediately return
in order to emulate disabling the timer?
Indeed, this is how I do it. But of course this isn't as immediate, but
so far works for my purposes. While this is a 'work around' that works,
it still seems odd that one can't launch (i.e., enable successfully) a
Timer inside recognition handlers. If this is a bug, I'd rather not have
to create the delayed infostructure I have and enable the Timer
directly. If this is a 'feature' (ala it is intended behaviour), then
I'll stick with the work around.
Could you print out the value of the InvokeRequired property of your
timer, seen inside the recognition handler?
[==Peter==]