I.T. Discussion Community!
-Collapse +Expand
Search Delphi Group:

-Collapse +Expand Delphi To/From
-Collapse +Expand Delphi Store

Prestwood eMagazine

August Edition
Subscribe now! It's Free!
Enter your email:

   ► KBProgrammingDelphi for W...Using Data   Print This     
Next Random Article Next Random Tidbit || Change Topic Random From All

Random Tidbit

Part of the mo. lesson in the Aug 08 Issue of Prestwood eMag
Delphi Code Snippet:
 A flashcard from our Delphi Flashcards Library
 A code snippet from our Delphi Code Snippets Page

I always found the sleep command in ObjectPAL very useful. The following code does about the same thing in Delphi. It makes use of GetTickCount which is a Win32 API call that retrieves the number of milliseconds that have elapsed since the system was started, up to 49.7 days.

procedure TUtils.Delay(MillisecondsDelay: Integer);
   FirstTickCount: LongInt;
   FirstTickCount := GetTickCount;
   until ((GetTickCount-FirstTickCount) >= Longint(MillisecondsDelay));


Share a thought or comment...
First Comment
Comment 1 of 4
I would avoid having to re-cast the long-int in each iteration, and I would bullet-proof the tickmax value against a negative delay parameter.

The ProcessMessages call assures the sytem responds to other processes during the iteration.

procedure tutils.delay(const millisecondsdelay: integer);
var tickmax: longint;
until GetTickCount>=tickmax;
Posted 12 years ago

Comment 2 of 4

Nice addition Mark, thanks.

Posted 12 years ago

Comment 3 of 4

Yeah, it‘s a great code for generating a message of application access, here to get the inexpensive website design for small business and improve business worth.

Posted 105 days ago

Latest Comment
Comment 4 of 4

Thanks for sharing the information. https://altrxlabs.com/services/private-white-label-cbd provides customers with THC free CBD oil so that they can get maximum advantages. The removal of THC is done through extractions.

Posted 76 days ago
Write a Comment...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.

Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1135A1
Enter key:
Code Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #100786 Counter
Since 4/2/2008

Follow PrestwoodBoards on: 

©1995-2020 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech