From: Rick on
I use extensively the timers in my View mfc application but I find the
documentation is not absolutely clear. I use the version with 3 paramteres -
the last one is NULL which indicates using the View OnTimer routine. In the
documentation it says to use KillTimer with the first parameter being used
in the SetTimer function and in some other palce to use it with the return
value of SetTimer.

Can someone clarify that plaeas?

Thanks

Rick.


From: thatsalok on

"Rick" <rick(a)cortex.com> wrote in message
-> I use extensively the timers in my View mfc application but I find
the
> documentation is not absolutely clear. I use the version with 3
paramteres -
> the last one is NULL which indicates using the View OnTimer routine. In
the
> documentation it says to use KillTimer with the first parameter being used
> in the SetTimer function and in some other palce to use it with the return
> value of SetTimer.

let understand that by using the Example
I think you are setting the timer using the
SetTimer(SOME_ID,Some_duration,NULL);

now if you want to Kill Timer, just pass the ID of Timer you used to create
timer
KillTimer(SOME_ID);

..I think you are confusing between the diffrent Version of Settimer Api i.e.
Win32 based and MFC based.


--

With Regards
Alok Gupta
Visit me at http://alok.bizhat.com

"I think this will Help"



From: Rick on
Thanks

And since I use few timers, what about the timer id being checked inside the
OnTimer function for teh code of each one of them - Should I check the
paramter SOME_ID or the return value from the SetTimer call?

Thanks again

Rick

"thatsalok" <thatsalok(a)NO_gmail.com_I_DONT_NEED_SPAM> wrote in message
news:OXHlBaWHFHA.3332(a)TK2MSFTNGP15.phx.gbl...
>
> "Rick" <rick(a)cortex.com> wrote in message
> -> I use extensively the timers in my View mfc application but I find
> the
> > documentation is not absolutely clear. I use the version with 3
> paramteres -
> > the last one is NULL which indicates using the View OnTimer routine. In
> the
> > documentation it says to use KillTimer with the first parameter being
used
> > in the SetTimer function and in some other palce to use it with the
return
> > value of SetTimer.
>
> let understand that by using the Example
> I think you are setting the timer using the
> SetTimer(SOME_ID,Some_duration,NULL);
>
> now if you want to Kill Timer, just pass the ID of Timer you used to
create
> timer
> KillTimer(SOME_ID);
>
> .I think you are confusing between the diffrent Version of Settimer Api
i.e.
> Win32 based and MFC based.
>
>
> --
>
> With Regards
> Alok Gupta
> Visit me at http://alok.bizhat.com
>
> "I think this will Help"
>
>
>


From: thatsalok on
Hi Rick
Nice to hear from you.
OnTimer(UINT nIDEvent) MFc function argument nIDEvent comes with id of
Timer which you have set with Setimer.

let's understand thats by the Example

let you have set the set the timer with ID_SOME_TIMER1, ID_SOME_TIMER2.

when ever Windows times Management notify you with timer event through
OnTimer(UINT nIdEvent)

OnTimer(UINT nIDEvent)
{
if(nIDEvent== ID_SOME_TIMER)
{
//Do something for timer ID_SOME_TIMER
}
else if(nIDEvent== ID_SOME_TIMER1)
{
//Do something for timer ID_SOME_TIMER1
}
}

hope now it's clear your doubt

--

With Regards
Alok Gupta
Visit me at http://alok.bizhat.com

"I think this will Help"




"Rick" <rick(a)cortex.com> wrote in message
news:#nSCZJXHFHA.3928(a)TK2MSFTNGP09.phx.gbl...
> Thanks
>
> And since I use few timers, what about the timer id being checked inside
the
> OnTimer function for teh code of each one of them - Should I check the
> paramter SOME_ID or the return value from the SetTimer call?
>
> Thanks again
>
> Rick
>
> "thatsalok" <thatsalok(a)NO_gmail.com_I_DONT_NEED_SPAM> wrote in message
> news:OXHlBaWHFHA.3332(a)TK2MSFTNGP15.phx.gbl...
> >
> > "Rick" <rick(a)cortex.com> wrote in message
> > -> I use extensively the timers in my View mfc application but I
find
> > the
> > > documentation is not absolutely clear. I use the version with 3
> > paramteres -
> > > the last one is NULL which indicates using the View OnTimer routine.
In
> > the
> > > documentation it says to use KillTimer with the first parameter being
> used
> > > in the SetTimer function and in some other palce to use it with the
> return
> > > value of SetTimer.
> >
> > let understand that by using the Example
> > I think you are setting the timer using the
> > SetTimer(SOME_ID,Some_duration,NULL);
> >
> > now if you want to Kill Timer, just pass the ID of Timer you used to
> create
> > timer
> > KillTimer(SOME_ID);
> >
> > .I think you are confusing between the diffrent Version of Settimer Api
> i.e.
> > Win32 based and MFC based.
> >
> >
> > --
> >
> > With Regards
> > Alok Gupta
> > Visit me at http://alok.bizhat.com
> >
> > "I think this will Help"
> >
> >
> >
>
>


From: Rick on
Thanks again,

Following you previous answer, I looked again in the MSDN help and saw that
the SetTimer version with the 3 parameters (I think that it belongs to the
CWnd class) - the one that I use, returns the ID number that should be used
with KillTimer. As I checked in the debugger it was usually similar to the
first argument given to SetTimer but still the example in the MSDN shows the
use of the return value as an argument to KillTimer.

Thanks in advance

Rick
"thatsalok" <thatsalok(a)NO_gmail.com_I_DONT_NEED_SPAM> wrote in message
news:eix#6zXHFHA.3472(a)TK2MSFTNGP09.phx.gbl...
> Hi Rick
> Nice to hear from you.
> OnTimer(UINT nIDEvent) MFc function argument nIDEvent comes with id
of
> Timer which you have set with Setimer.
>
> let's understand thats by the Example
>
> let you have set the set the timer with ID_SOME_TIMER1, ID_SOME_TIMER2.
>
> when ever Windows times Management notify you with timer event through
> OnTimer(UINT nIdEvent)
>
> OnTimer(UINT nIDEvent)
> {
> if(nIDEvent== ID_SOME_TIMER)
> {
> file://Do something for timer ID_SOME_TIMER
> }
> else if(nIDEvent== ID_SOME_TIMER1)
> {
> file://Do something for timer ID_SOME_TIMER1
> }
> }
>
> hope now it's clear your doubt
>
> --
>
> With Regards
> Alok Gupta
> Visit me at http://alok.bizhat.com
>
> "I think this will Help"
>
>
>
>
> "Rick" <rick(a)cortex.com> wrote in message
> news:#nSCZJXHFHA.3928(a)TK2MSFTNGP09.phx.gbl...
> > Thanks
> >
> > And since I use few timers, what about the timer id being checked inside
> the
> > OnTimer function for teh code of each one of them - Should I check the
> > paramter SOME_ID or the return value from the SetTimer call?
> >
> > Thanks again
> >
> > Rick
> >
> > "thatsalok" <thatsalok(a)NO_gmail.com_I_DONT_NEED_SPAM> wrote in message
> > news:OXHlBaWHFHA.3332(a)TK2MSFTNGP15.phx.gbl...
> > >
> > > "Rick" <rick(a)cortex.com> wrote in message
> > > -> I use extensively the timers in my View mfc application but I
> find
> > > the
> > > > documentation is not absolutely clear. I use the version with 3
> > > paramteres -
> > > > the last one is NULL which indicates using the View OnTimer routine.
> In
> > > the
> > > > documentation it says to use KillTimer with the first parameter
being
> > used
> > > > in the SetTimer function and in some other palce to use it with the
> > return
> > > > value of SetTimer.
> > >
> > > let understand that by using the Example
> > > I think you are setting the timer using the
> > > SetTimer(SOME_ID,Some_duration,NULL);
> > >
> > > now if you want to Kill Timer, just pass the ID of Timer you used to
> > create
> > > timer
> > > KillTimer(SOME_ID);
> > >
> > > .I think you are confusing between the diffrent Version of Settimer
Api
> > i.e.
> > > Win32 based and MFC based.
> > >
> > >
> > > --
> > >
> > > With Regards
> > > Alok Gupta
> > > Visit me at http://alok.bizhat.com
> > >
> > > "I think this will Help"
> > >
> > >
> > >
> >
> >
>
>