View Full Version : Timer Event
aghle
18 Sep 2002, 05:07 PM
Hi!
Does anybody know, how to code a timed event? I want to make a simple world-time-clock-plugin, so I'll have to update the entry at an interval.
I want to do this in Delphi, so some Delphi suggestions are great, but maybe C can help, too %-)
rolith_te
18 Sep 2002, 05:46 PM
have you tried scheduler under events? (prefrences->events->advanced-> add) there is the abilty to set timed events... is that what you want, or is there more?
aghle
19 Sep 2002, 05:28 AM
Nah, this won't work. First, these events can be set for only once a day. I need it every minute.
I just want to put a text on the contact list to show the actual time of another time zone.
amurgshere
19 Sep 2002, 05:32 AM
Just user a TTimer component created at runtime, and assign the event after you have created it!!
Or if you want to go a bit lower level you can use the SetTimer and KillTimer Win API procedures
If you arent sure what i mean let me know and i will give you an example!! :)
aghle
19 Sep 2002, 05:37 AM
Yeah, I've tried this, but somehow I didn't get this to work. /_\
amurgshere
19 Sep 2002, 05:45 AM
This code works for me:
Var iTimer : LongInt;
Procedure TimerProc(HWND : hwnd; uMsg, idEvent : UINT; dwTime : DWORD); stdcall;
// Make sure the callback is a "stdcall"
Begin
// Timer code here :)
// idEvent will equal iTimer
End;
// Create timer code
iTimer := SetTimer(0, 0, 5000, @TimerProc); // Create timer at 5 seconds
// Remove timer - be sure to do this when your program is terminated
KillTimer(0, iTimer);
aghle
19 Sep 2002, 07:52 AM
Thanks a lot! :D
vBulletin® v3.8.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.