On Sat, Jun 30, 2018 at 9:13 PM, R0b0t1 <r03...@gmail.com> wrote: > On Sat, Jun 30, 2018 at 3:57 PM, Marcos Douglas B. Santos > <m...@delfire.net> wrote: >> Hi, >> >> I need to build a daemon app on Windows. It will need a timer to >> performe some tasks. This timer could be big among 15 min, 30 min, 2 >> hours, etc. >> >> I thought that I can use TTimer but I've always heard that it's not >> possible because some problems related with "NoGUI" stuff. >> >> I've found a thread[1] which talks about that but they haven't >> provided a real solution, at least for Windows. >> >> My question is: Nowadays, can I use TTimer with no restrictions in a >> daemon application on Windows? If not, which could be a possible >> solution? >> > > If all your service does is wait for the timer you should instead use > a scheduled task.
Actually, it could be a better idea. I will check the requirements and think if this would be possible. > Anyway - does TTimer use the WM_TIMER message? That is the type tied > to the GUI. Even if you need to use WM_TIMER for some reason you can, > as services should be run in "session 0" and should have access to a > GUI. The latter is, I think, a compatibility option you can enable. I didn't understand this "session 0"... is it a something related to Lazarus or Windows? > If you are not opposed to OS-level primitives you should use waitable > timers > (https://docs.microsoft.com/en-us/windows/desktop/sync/using-waitable-timer-objects). > Using waitable timers you can also wake the computer from sleep. I'm not opposed at all. Indeed I didn't know these functions... sounds a good option. Thanks. Regards, Marcos Douglas _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal