<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=GB2312" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
the problem is, that a normal thread does not have a message queue. <br>
You can create a second thread, which calls some method in a periodic
cycle and sleeps in between. But you must take care, that this thread
is synchronized to your daemon thread.<br>
<br>
Adrian.<br>
<br>
Am 19.02.2010 16:19, schrieb Joshua Lim:
<blockquote cite="mid:COL105-W6085233B9E489394C8A7F9AD460@phx.gbl"
type="cite">
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
<pre>Hi Michael, thanks, is there a work around solution to simulating a trigger in a Lazdaemon?
Rgds,
Joshua
</pre>
<hr id="stopSpelling">From: <b>Michael Van Canneyt</b>
<pre>
The standard driver for fpTimer is not suitable for use in a daemon
application, as the timer events are only triggered in the main thread,
and each daemon runs in its own thread.
Michael.
</pre>
<br>
<hr id="stopSpelling">From: joshua__lim<br>
To: <a class="moz-txt-link-abbreviated" href="mailto:lazarus@lists.lazarus.freepascal.org">lazarus@lists.lazarus.freepascal.org</a><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 -
<a class="moz-txt-link-freetext" href="http://mantis.freepascal.org/view.php?id=14118&nbn=5">http://mantis.freepascal.org/view.php?id=14118&nbn=5</a><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
fpTimer;
...
TDaemon1 = class(TDaemon)
....
private
.....
public
procedure FTimerTimer( Sender : TObject );
.....
var
Daemon1: TDaemon1;
FTimer : TFPTimer;
.....
procedure TDaemon1.FTimerTimer( Sender : TObject );
var
...
BEGIN
....
END;
procedure TDaemon1.DataModuleStart(Sender: TCustomDaemon; var OK: boolean);
var
...
begin
FTimer := TFPTimer.Create(nil);
&nbs
p;FTimer.OnTimer := @FTimerTimer;
FTimer.Interval := 1000; // in milliseconds
FTimer.Enabled := True;
FTimer.StartTimer;</pre>
<br>
<br>
<br>
Note: I've also posted here -
<a class="moz-txt-link-freetext" href="http://lazarus.freepascal.org/index.php/topic,8615.0.html">http://lazarus.freepascal.org/index.php/topic,8615.0.html</a><br>
<br>
<br>
<br>
<hr>Hotmail: Free, trusted and rich email service. <a
moz-do-not-send="true"
href="https://signup.live.com/signup.aspx?id=60969">Get it now.</a> <br>
<hr>Hotmail: Free, trusted and rich email service. <a
moz-do-not-send="true"
href="https://signup.live.com/signup.aspx?id=60969" target="_new">Get
it now.</a>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
--
_______________________________________________
Lazarus mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
</pre>
</blockquote>
</body>
</html>