Delphi Function Snippets


The IsFileInUse Delphi function will return true if the file is locked for exclusive access. False is returned if the file does not exist. Code "flow": Two things need to be checked here: A) Is the file a READ-ONLY file? and B) Is the file in use? The main point of the excercise is to check the files attributes for the READ-ONLY...

The IsFileInUse Delphi function will return true if the file is locked for exclusive access. False is returned if the file does not exist. Code "flow": Two things need to be checked here: A) Is the file a READ-ONLY file? and B) Is the file in use? The main point of the excercise is to check the files attributes for the READ-ONLY flag...

05 September, 2013   

Making a transparent form. Add a Button (Button1) to a Delphi form (Form1)...

12 March, 2013   

Delphi code example to draw a gradient line

The ActiveControl property of a Delphi Form object specifies what control has the input focus. You can use this property to set what control is (initially) focused when the form is created and displayed to the user. If you want to move the mouse cursor to the control with the focus, you can use the next code in the form's OnCreate event handler...

Delphi code for using CreateProcess to Execute Programs

Delphi code example Using CreateProcess to Execute Programs

02 December, 2012   

Delphi code example to extract a resource to file

24 April, 2014   

[UNIT] Im Spreading. I posted it as learning to defend yourself.

28 April, 2011   

Over the years I have made quite a few software programs in Delphi, and inevitably I have also come up with many useful functions. Most of them I have never published on the Internet before, now I would like to list on blog. Part 1 are functions for managing integer or real numbers, they were written very early in 1997.

Example source code for function pointer to member function of class

C++ code snippet for function pointer to member function of class

22 October, 2013   

Delphi example code for Hex Color to RGB Color

12 August, 2012   

Simple but utilitarian function returns a numeric array of associative arrays containing an entire result set.

18 June, 2011   

You can create a function for logging system

11 July, 2011   

We have created our first function, but a function usually need one or more parameters, so let us have a look at that. The next function is a simple echo function which just print the text to screen.

02 April, 2012   

Delphi code example for Grayscaling A Bitmap

16 April, 2011   

There are times when you need to split a large file into several smaller ones (for whatever the purpose is). The following two methods use Delphi TStream objects to break a file into several files with predefined size; and to merge those files back to the original.

04 February, 2012   

PHP function example that writes a name when it is called.

Simple way to do the opposite of what the nl2br() function does- turns breaks () into new lines.