All Delphi

Everything You Want To Know From VCL, Tips To Snippet All Everything About Delphi And CodeGear Related

Archive for the 'Snippet' Category

How To Retrieve Temporary Folder

26th November 2009

AllDelphi.com Reader ,Have you ever got to the point where you need to know what is the full path for temporary folder on your system ?, or maybe need the temporary folder to put some scratch file or temporary file to be use on your system but don’t know for sure where is the temporary folder exact path ?
Well , dont worry bellow is the snippet that you can use,
enojy..
Read the rest of this entry »

Posted in Snippet | No Comments »

Formatting a File Size in Bytes for Display

15th October 2008

When working with files from Delphi you might want to display the size of a file to the user in a Explorer-like format where the file size is not displayed in bytes – but the display depends on the size of the actual file.

To most users “45678123 b” is confusing – where “43.56 MB” is much more user friendly.

Format Byte Size to String

A custom Delphi function, FormatByteSize, converts a byte value into a string that represents the number expressed as a size value in bytes, kilobytes, megabytes, or gigabytes, depending on the size.
Read the rest of this entry »

Posted in Snippet, Tips | No Comments »

Using Semaphores in Delphi, Part 2: The Connection Pool

30th September 2008

Too Read The Previous Article Please Read This..
Abstract: Semaphores are used to coordinate multiple threads and processes. That semaphores provide multiple threads with simultaneous access to a shared resource is highlighted by the TFixedConnectionPool class described in this article.

Semaphores are like mutexes on steroids. Not only do they provide for blocking thread synchronization, but they permit two or more threads, up to some specified maximum number, to work concurrently with a shared resource. As a result, they are unlike most other synchronization objects, which typically provide access to one thread at a time. For an introduction to the creation and use of semaphores, read the preceding article in this series on the Borland Developer Network site by clicking here. Read the rest of this entry »

Posted in Snippet, Tips | No Comments »

Using Semaphores In Delphi

14th September 2008

Abstract: Semaphores are like mutexes on steroids. Not only can they coordinate multiple threads and process, but they can permit more than one simultaneous lock. This article shows you how to use these useful objects in a multithreaded environment

Semaphores are powerful synchronization objects that, like mutexes (mutually exclusives), permit you to coordinate multiple threads and processes in your Delphi applications. Likewise, in multithreaded server environments, such as WebSnap, Web Broker ISAPI servers, and IntraWeb applications, semaphores provide a flexible mechanism for protecting shared resources.
Read the rest of this entry »

Posted in Snippet, Tips | No Comments »

How To Make DBGrid Autosize

14th July 2008

Hi all delphi readers, have you all confront with this situation, imagine you have created some nice application with superb GUI (Graphical User Interface) but then when you do the final testing and review you find out that. Data that has longger length compare to DBGrid field length was castrate..that was very – very annoying. yeah ..I also think so i know this feeling because I’ve been there.. :D Read the rest of this entry »

Posted in Snippet, Tips | No Comments »

How To Coloring DBGRID Row

12th July 2008

hi all delphi readers, You’ve seen this surely on web pages. Alternating table row colors means displaying the first record in one color and the second record in another color and continue to alternate the color of each row displayed. Read the rest of this entry »

Posted in Snippet, Tips | No Comments »

How to sent file to recycle bin in delphi

30th June 2008

hi all delphi reader, today i want to share how to delete or sent files to recycle bin so after deletetion we can retrieve again the file.

Here’s a Delphi procedure that can delete a file with the ability to undo by sending the file to the “Recycle Bin. “Function bFileDelete” will return True if the operation was successful. Read the rest of this entry »

Posted in Snippet, Tips | No Comments »

How To Create A Roll Up Form (with animation)

28th June 2008

hello, alldelphi.com reader todays tips is .. how to create a roll up form with animation. sure we now there are several component that can do that trick such as billenium and also one of the JEDI component. But surely if we can do it our self why buy or used another component right ? Read the rest of this entry »

Posted in Snippet, Tips | No Comments »

How To Track User’s Idle Time

26th June 2008

Hello alldelphi.com users, we meet again today i want to show you some interesting snippet :D

Suppose you have a data-critical type of application where you would not want a non-authored user to work with the data. Such an application could automatically log out the current user if no user activity has taken place in a lengthy time.

To track a user’s idle time you could hook keyboard and mouse activity. Note, however, that installing a system-wide message hook is a very invasive thing to do and should be avoided if possible, since it will require your hook DLL to be loaded into all processes. Read the rest of this entry »

Posted in Snippet, Tips | 1 Comment »

Thread Safe StringList

16th June 2008

Hi Guys, it’s been a while since my last posting here. There are alot of responsibility now on my job. Recently  i got opportunity to play with threading again and this this time those multiple threading accesing one same TStringList.

for some of alldelphi.com user that has experienced on  multithreading field, i think already know that borland Delphi standard TStringlist is not a thread safe. let say that i have learned it the hardway i took several scratching on the head and slap on my forehand before i realiase that the TStringList is not a thread safe, so i need to figure out how to make the stringlist become a thread safe.Luckyly for me that a quick serach on google show this source . Read the rest of this entry »

Posted in Snippet, Tips | 2 Comments »