Hi, all,

I created one timer in one console application, and this timer associated
with one timer-function. This console application also printed some string
at console screen.

Now the problem is that the timer funcion never fired though the timer was
really created successfully because the timer ID was valid. But if I
created one separate thread and created the timer within this thread, then
all things OK.

Why? We shouldn't create timer in console thread that interacts with user?
Any one could answer me? Thanks.

aling

--

Re: why timer not fired in console application? by Alexander

Alexander
Thu Nov 20 14:38:35 CST 2003

For Windows timers (SetTimer) to work, you need a message loop. See the
documentation.

"Aling" <alingsjtu@21cn.com> wrote in message
news:Oi16IvyrDHA.1600@TK2MSFTNGP10.phx.gbl...
> Hi, all,
>
> I created one timer in one console application, and this timer associated
> with one timer-function. This console application also printed some string
> at console screen.
>
> Now the problem is that the timer funcion never fired though the timer was
> really created successfully because the timer ID was valid. But if I
> created one separate thread and created the timer within this thread, then
> all things OK.
>
> Why? We shouldn't create timer in console thread that interacts with
user?
> Any one could answer me? Thanks.
>
> aling
>
> --
>
>
>



Re: why timer not fired in console application? by Roy

Roy
Thu Nov 20 17:36:15 CST 2003

Alexander

I don't understand, could you elaborate....

rlf


"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:u$DFHZ6rDHA.3140@TK2MSFTNGP11.phx.gbl...
> For Windows timers (SetTimer) to work, you need a message loop. See the
> documentation.
>
> "Aling" <alingsjtu@21cn.com> wrote in message
> news:Oi16IvyrDHA.1600@TK2MSFTNGP10.phx.gbl...
> > Hi, all,
> >
> > I created one timer in one console application, and this timer
associated
> > with one timer-function. This console application also printed some
string
> > at console screen.
> >
> > Now the problem is that the timer funcion never fired though the timer
was
> > really created successfully because the timer ID was valid. But if I
> > created one separate thread and created the timer within this thread,
then
> > all things OK.
> >
> > Why? We shouldn't create timer in console thread that interacts with
> user?
> > Any one could answer me? Thanks.
> >
> > aling
> >
> > --
> >
> >
> >
>
>



Re: why timer not fired in console application? by Alexander

Alexander
Thu Nov 20 21:21:20 CST 2003

Windows calls timer callbacks while in GetMessage call. See timers in the
SDK documentation.

"Roy Fine" <rlfine@twt.obfuscate.net> wrote in message
news:uACRH97rDHA.2364@TK2MSFTNGP09.phx.gbl...
> Alexander
>
> I don't understand, could you elaborate....
>
> rlf
>
>
> "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
> news:u$DFHZ6rDHA.3140@TK2MSFTNGP11.phx.gbl...
> > For Windows timers (SetTimer) to work, you need a message loop. See the
> > documentation.
> >
> > "Aling" <alingsjtu@21cn.com> wrote in message
> > news:Oi16IvyrDHA.1600@TK2MSFTNGP10.phx.gbl...
> > > Hi, all,
> > >
> > > I created one timer in one console application, and this timer
> associated
> > > with one timer-function. This console application also printed some
> string
> > > at console screen.
> > >
> > > Now the problem is that the timer funcion never fired though the timer
> was
> > > really created successfully because the timer ID was valid. But if I
> > > created one separate thread and created the timer within this thread,
> then
> > > all things OK.
> > >
> > > Why? We shouldn't create timer in console thread that interacts with
> > user?
> > > Any one could answer me? Thanks.
> > >
> > > aling
> > >
> > > --
> > >
> > >
> > >
> >
> >
>
>



Re: why timer not fired in console application? by Roy

Roy
Thu Nov 20 21:24:51 CST 2003

Alexander

you still don't get it, do you????

regards
roy fine


"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:#eDvK69rDHA.2260@TK2MSFTNGP09.phx.gbl...
> Windows calls timer callbacks while in GetMessage call. See timers in the
> SDK documentation.
>
> "Roy Fine" <rlfine@twt.obfuscate.net> wrote in message
> news:uACRH97rDHA.2364@TK2MSFTNGP09.phx.gbl...
> > Alexander
> >
> > I don't understand, could you elaborate....
> >
> > rlf
> >
> >
> > "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
> > news:u$DFHZ6rDHA.3140@TK2MSFTNGP11.phx.gbl...
> > > For Windows timers (SetTimer) to work, you need a message loop. See
the
> > > documentation.
> > >
> > > "Aling" <alingsjtu@21cn.com> wrote in message
> > > news:Oi16IvyrDHA.1600@TK2MSFTNGP10.phx.gbl...
> > > > Hi, all,
> > > >
> > > > I created one timer in one console application, and this timer
> > associated
> > > > with one timer-function. This console application also printed some
> > string
> > > > at console screen.
> > > >
> > > > Now the problem is that the timer funcion never fired though the
timer
> > was
> > > > really created successfully because the timer ID was valid. But if
I
> > > > created one separate thread and created the timer within this
thread,
> > then
> > > > all things OK.
> > > >
> > > > Why? We shouldn't create timer in console thread that interacts
with
> > > user?
> > > > Any one could answer me? Thanks.
> > > >
> > > > aling
> > > >
> > > > --
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: why timer not fired in console application? by Aling

Aling
Thu Nov 20 21:40:49 CST 2003

Hi, Roy & Alexander,

Thank you very much, I really appreciate your help.

Best Regards
Aling


"Roy Fine" <rlfine@twt.obfuscate.net> wrote in message
news:%23i0K389rDHA.2416@TK2MSFTNGP10.phx.gbl...
> Alexander
>
> you still don't get it, do you????
>
> regards
> roy fine
>
>
> "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
> news:#eDvK69rDHA.2260@TK2MSFTNGP09.phx.gbl...
> > Windows calls timer callbacks while in GetMessage call. See timers in
the
> > SDK documentation.
> >
> > "Roy Fine" <rlfine@twt.obfuscate.net> wrote in message
> > news:uACRH97rDHA.2364@TK2MSFTNGP09.phx.gbl...
> > > Alexander
> > >
> > > I don't understand, could you elaborate....
> > >
> > > rlf
> > >
> > >
> > > "Alexander Grigoriev" <alegr@earthlink.net> wrote in message
> > > news:u$DFHZ6rDHA.3140@TK2MSFTNGP11.phx.gbl...
> > > > For Windows timers (SetTimer) to work, you need a message loop. See
> the
> > > > documentation.
> > > >
> > > > "Aling" <alingsjtu@21cn.com> wrote in message
> > > > news:Oi16IvyrDHA.1600@TK2MSFTNGP10.phx.gbl...
> > > > > Hi, all,
> > > > >
> > > > > I created one timer in one console application, and this timer
> > > associated
> > > > > with one timer-function. This console application also printed
some
> > > string
> > > > > at console screen.
> > > > >
> > > > > Now the problem is that the timer funcion never fired though the
> timer
> > > was
> > > > > really created successfully because the timer ID was valid. But
if
> I
> > > > > created one separate thread and created the timer within this
> thread,
> > > then
> > > > > all things OK.
> > > > >
> > > > > Why? We shouldn't create timer in console thread that interacts
> with
> > > > user?
> > > > > Any one could answer me? Thanks.
> > > > >
> > > > > aling
> > > > >
> > > > > --
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>