<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
<pre>Hi Michael, thanks, is there a work around solution to simulating a trigger in a Lazdaemon?<br><br>Rgds,<br>Joshua<br><br><br></pre><hr id="stopSpelling">From: <b>Michael Van Canneyt</b><pre><br>The standard driver for fpTimer is not suitable for use in a daemon<br>application, as the timer events are only triggered in the main thread,<br>and each daemon runs in its own thread.<br><br>Michael.<br></pre><br><hr id="stopSpelling">From: joshua__lim<br>To: lazarus@lists.lazarus.freepascal.org<br>Subject: Having trouble getting fptimer to work in a Daemon.<br>Date: Mon, 15 Feb 2010 10:02:48 +0000<br><br>
<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</style>
Hi,<br><br>I'm a pascal newbie, after spending some time getting a daemon to work, I now have trouble getting a timer to work. I was recommended to use TFPTimer from the fpTimer unit - http://mantis.freepascal.org/view.php?id=14118&nbn=5<br><br>I tried the following code but the OnTimer doesn't trigger. There are no errors either. Grateful for any pointers. :)<br><br><pre style="display: inline;">uses<br>fpTimer;<br>...<br> TDaemon1 = class(TDaemon)<br>....<br>private<br>.....<br>public<br> procedure FTimerTimer( Sender : TObject ); <br>.....<br>var<br> Daemon1: TDaemon1;<br> FTimer : TFPTimer;<br>.....<br>procedure TDaemon1.FTimerTimer( Sender : TObject );<br>var<br>...<br> BEGIN<br>....<br>END; <br><br>procedure TDaemon1.DataModuleStart(Sender: TCustomDaemon; var OK: boolean);<br>var<br>...<br>begin <br> FTimer := TFPTimer.Create(nil);<br> FTimer.OnTimer := @FTimerTimer;<br> FTimer.Interval := 1000; // in milliseconds<br> FTimer.Enabled := True; <br> FTimer.StartTimer;</pre><br><br><br>Note: I've also posted here - http://lazarus.freepascal.org/index.php/topic,8615.0.html<br><br><br> <br><hr>Hotmail: Free, trusted and rich email service. <a href="https://signup.live.com/signup.aspx?id=60969">Get it now.</a> <br /><hr />Hotmail: Free, trusted and rich email service. <a href='https://signup.live.com/signup.aspx?id=60969' target='_new'>Get it now.</a></body>
</html>