hello.
may i know is there a Timer control in VC++ and how to use that??
can provide me some code samples also? hehe..
thanks..
Printable View
hello.
may i know is there a Timer control in VC++ and how to use that??
can provide me some code samples also? hehe..
thanks..
You may use the varius timer API functions. For instance, the SetTimer() function will create the timer and call your specified call-back function every n milliseconds. Hence, the KillTimer() function will destroy the timer you created when using the SetTimer() function.
The best way I find is to just run through an infinate loop using GetTickCount() instead.
ok.. thanks.
i'll try that out .
so doesn't VC++ have something like a Timer Control, ?
like in Borland C builder..
thank you..
Do you actually *know* C++?
I wouldn't recommend starting with MFC.
C++ is *not* a RAD language, like VB or C++ Builder.
ok.. fine..
thanks 4 ur advice..
:mad:
lol, why would you want to use a control? ... Just use SetTimer, and you can create a callback function. ... Works pretty much like the Timer control in VB, but better. :)
Actually all the VB timer control does is calling SetTimer...
You're better off using timeSetEvent, it's far more reliable.
what's timeSetEvent?
The multimedia timers. Far more stable, and accurate to 1ms.
I have a vague memory of using them in VB at sometime, and that they used to crash the IDE :S
It's not difficult to crash VB. If you have pointers to things they get juggled around and then the callbacks don't work.
hmm.. I dont care about VB anyway, so doesnt matter, probably going to be useful.
But if accuracy or reliability is not needed (such as for an autosave, it doesn't need to come exactly to the millisecond), SetTimer is better because it's easier to use and doesn't require an answering thread. And timeSetEvent lays several restrictions on the user.