<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Lazarus Pascal - How to make a Delay/Sleep without locking up your application - Delphi, Lazarus, Free Pascal				            </title>
            <link>https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-pascal-how-to-make-a-delay-sleep-without-locking-up-your-application/</link>
            <description>Tweaking4All.com Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Mon, 20 Apr 2026 13:09:45 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Lazarus Pascal - How to make a Delay/Sleep without locking up your application</title>
                        <link>https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-pascal-how-to-make-a-delay-sleep-without-locking-up-your-application/#post-1561</link>
                        <pubDate>Tue, 26 Mar 2019 09:21:53 +0000</pubDate>
                        <description><![CDATA[Since the previous functions uses GetTickCount, which has its issues and GetTickCount64 appears a better choice, you may also want to consider the alternative below, which uses TDateTime ins...]]></description>
                        <content:encoded><![CDATA[<p>Since the previous functions uses <a href="https://www.freepascal.org/docs-html/rtl/sysutils/gettickcount.html" target="_blank" rel="noopener noreferrer">GetTickCount</a>, which has its issues and <a href="https://www.freepascal.org/docs-html/rtl/sysutils/gettickcount64.html" target="_blank" rel="noopener noreferrer">GetTickCount64</a> appears a better choice, you may also want to consider the alternative below, which uses TDateTime instead, where we can set our delay in milliseconds (1000=1sec).</p>
<p><i>Note</i>: uses the <strong>dateutils</strong> unit.</p>
<pre contenteditable="false">procedure MyDelay(milliSecondsDelay: int64);<br />var<br />  stopTime : TDateTime;<br />begin<br />  stopTime := IncMilliSecond(Now,milliSecondsDelay);<br />  while (Now &lt; stopTime) and (not Application.Terminated) do<br />    Application.ProcessMessages;<br />end;</pre>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/">Delphi, Lazarus, Free Pascal</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-pascal-how-to-make-a-delay-sleep-without-locking-up-your-application/#post-1561</guid>
                    </item>
				                    <item>
                        <title>Lazarus Pascal - How to make a Delay/Sleep without locking up your application</title>
                        <link>https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-pascal-how-to-make-a-delay-sleep-without-locking-up-your-application/#post-508</link>
                        <pubDate>Sun, 10 Feb 2019 09:52:27 +0000</pubDate>
                        <description><![CDATA[So I had to add a delay (better said: sleep) in my code, so that after displaying a temporary status message, would revert back to it&#039;s previous message. Kind-a like a brief bleep showing a ...]]></description>
                        <content:encoded><![CDATA[<p>So I had to add a delay (better said: sleep) in my code, so that after displaying a temporary status message, would revert back to it's previous message. Kind-a like a brief bleep showing a notification and then going back to where we left off.</p><p>Now the sleep() function has a little problem ... it's totally locks your application (Zzz mouse, or spinning ball) and the user can't really do anything.</p><p>With a neat little trick you can do this better;</p><pre>procedure <b>MyDelay</b>(DelayTickCount: DWORD);<br>&nbsp; var<br>&nbsp; &nbsp; StartTickCount : DWORD;<br>&nbsp; begin<br>&nbsp; &nbsp; StartTickCount := GetTickCount;<br>&nbsp; &nbsp; while (GetTickCount &lt; StartTickCount + DelayTickCount) and (not Application.Terminated) do<br>&nbsp; &nbsp; &nbsp; Application.ProcessMessages;<br>&nbsp; end;&nbsp; &nbsp;</pre><p>So this function does NOT lock you user interface, but does wait with the next steps for "DelayTickCount" milliseconds.</p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/">Delphi, Lazarus, Free Pascal</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/lazarus-pascal-how-to-make-a-delay-sleep-without-locking-up-your-application/#post-508</guid>
                    </item>
							        </channel>
        </rss>
		