Delphi: Most Popular Articles
Symbolic constant names, hexadecimal values, and keyboard equivalents for the virtual key codes used by Windows.
Executing and Running Applications and Files from Delphi Code.
Date/Time Delphi functions and procedures in RTL: rtl reference delphi programming time routines ordinal position date function
The concept of arrays in Delphi is simple: arrays allow us to refer to a series of variables by the same name and to use a number (an index) to tell them apart. Arrays have both upper and lower bounds, and the elements of the array are contiguous within those bounds.
class="no-js" itemscope itemtype="http://schema.org/Article" > itemprop="description" >Ok, let's get
A Beginner's Guide to Delphi Programming. Free online programming tutorial / course for beginner developers. Focus on Borland Delphi.
While in most situations you will arrange all the controls on a Delphi form in a 'fixed' position, there are situations where you need to allow a user to change the placement and dimension of controls at run-time. Here's how to enable dragging and resizing controls with mouse, while the application is running.
Delphi's Pos function returns an integer specifying the position of the first occurrence of one string within another.
Get familiar with the OnKeyDown, OnKeyUp, and onKeyPress Delphi event procedures to respond to various key actions or handle and process ASCII characters along with other special purpose keys.
Whispering about reverse engineering Delphi applications: 'I have a Delphi program's .exe, can I decompile it and get the source?'. Page 3.
The .INI files have a text-based file format for representing application configuration data in a format which is easily editable by humans and readable by a simple automatic parser. Learn how to use Delphi's TIniFile to read and write INI configuration files.
The Windows Clipboard represents the container for any text or graphics that are cut, copied or pasted from or to an application. This article will show you how to use the TClipboard object to implement cut-copy-paste features in your Delphi application.
Exchanging Data over the Network using Delphi. In this article we'll examine two Delphi components: TServerSocket and TClientSocket, both designed to let you read and write information over a TCP/IP connection - thus enabling you to write network-aware applications.
A Dynamic Link library, or DLL, is a collection of routines (small programs) that can be called by applications and by other DLLs. Using Delphi, we can write and use our own DLLs, and we can call functions in DLLs developed with other systems / by other developers. Find out how.
A Beginner's Guide to ASP.NET Programming for Delphi developers: Chapter 18. Find out what events (and in what order) are generated when ASP.NET receives a request for a Web Form. Learn about the ViewState - a technique ASP.NET uses to maintain page state changes across postbacks.
String handling routines: rtl reference cr lf delphi programming dynamic array case sensitivity
Looking for a single-file, single-user database for your next Delphi application? Need to store some application specific data but you do not want to user the Registry / INI / or something else?
Understanding and managing string data types in Delphi's Object Pascal. Learn about differences between Short, Long, Wide and null-terminated strings.
An introduction to pointer data type in Delphi. What are pointers, why, when and how to use them.
Using Structured Query Language in Delphi.: tquery component delphi sql dbase tables interbase server component delphi
Everything you need to know about Delphi and the Extensible Markup Language. Find out about creating and parsing XML documents, look for parser components and more.
Multi-threading in Delphi lets you create applications that include several simultaneous paths of execution. When several threads are running in the application a question arises: how to update your GUI (user interface) as a result of a thread execution. The question lies in the TThread class Synchronize method.
Sorting records in Delphi DBGrid. How to sort records in Delphi DbGrid by clicking on the column title. Plus: how to change the appearance of the selected column title to reflect the sort order. Even more: how to change the cursor when moving over the DBGrid column titles.
Accessing and managing MS Excel sheets with Delphi. How to retrieve, display and edit Microsoft Excel spreadsheets with ADO (dbGO) and Delphi. This step-by-step article describes how to connect to Excel, retrieve sheet data, and enable editing of data (using the DBGrid). You'll also find a list of most common errors (and how to deal with them) that might pop up in the process.
class="no-js" itemscope itemtype="http://schema.org/Article" > itemprop="description" >Contrary to most
Coloring DBGrid. How to enhance the functionality of a TDBgrid component using colors
There are situations when you want to display a list of strings to the user, for example in the list box control, but also have a way to store one more additional string (or event an object instance) along the one displayed to the user. Here's how when using Delphi.
Free online database programming course for beginner Delphi developers. Focus on ADO techniques.
Storing more that just code in the application executable file. Working with resources from Delphi. How to embed a WAV, AVI and an MP3 file in a Delphi executable.
Before you can call routines defined in DLL, you must import them. Functions exported from a DLL can be imported in two ways: by declaring an external procedure or function (static), or by direct calls to DLL specific API functions (dynamic). What should be used when: static or dynamic loading of DLLs in Delphi.
Introduced in Delphi 2009, the TDictionary class, defined in Generics.Collections unit, represents a generic hash table type collection of key-value pairs. In Delphi, the TDictionary is defined as a hash table. Hash tables represents a collection of key-and-value pairs that are organized based on the hash code of the key. Hash tables are optimized for lookups (speed). When a key-value pair is added to a hash table, the hash of the key is computed and stored along with the added pair.
List of the file extensions created (and used) by Delphi and what they all mean. Plus, get to know what Delphi generated files should be stored in a source control system.
Drop down list (DBLookupComboBox) inside a DBGrid - part 2. Here's how to place a DBLookupComboBox into a DBGrid. Create visually more attractive user interfaces for editing lookup fields inside a DBGrid - place a DBLookupComboBox into a cell of a DBGrid.
Windows Service applications take requests from client applications, process those requests, and return information to the client applications. They typically run in the background, without much user input. Services can be automatically started when the computer boots, can be paused and restarted, and do not show any user interface.
Free components, with code, made by the visitors of the About Delphi Programming community.
Stop. This is the one and only solution to file searching. Use Delphi to find any file in any directory and/or subdirectory that match a certain mask. Start searching.
Loops allow you to execute a sequence of statements repeatedly, using a control condition or variable to determine when the execution stops. Delphi has three kinds of control loop: repeat statements, while statements, and for statements. Learn how to use loops in Delphi programming.
Whispering about reverse engineering Delphi applications: 'I have a Delphi program's .exe, can I decompile it and get the source?'
Let's enable uploading of binary files from a client browser to the web server in ASP.Net web applications. Delphi for .Net and ASP.NET provide an easy way to accept files from the client using HTMLInputFile ('HTML File Upload' HTML server control) and HTTPPostedFile classes.
Delphi makes it easy to program dragging & dropping into our applications. We can even drag and drop from one form to another or from Windows Explorer to our application, or from-to what ever we want, as you will see.
How Delphi uses standard Windows-format resource files: icons, bitmaps and cursors.
One of the Delphi language features not found in other modern languages is the notion of sets. Delphi's set type is a collection of values of the same ordinal type. Learn about Delphi sets to better understand Delphi source code.
Adjusting Delphi's DBGrid column widths automatically. Here's a handy method to automatically fix the size of TDBGrid columns (at run-time) to fit the DBGrid width (remove the unfilled space at the right edge of the grid; and consequently remove the horizontal scroll bar) when the user resizes the container containing the grid.
The differences between a Delphi component Owner and its Parent explained. Plus: when to use the Controls and Component properties of a Delphi component.
class="no-js" itemscope itemtype="http://schema.org/Article" > itemprop="description" >The MainForm of
How to pass command-line parameters to your Delphi application and how to handle them.
Examining the life cycle of a Delphi Form - the central element of development in Delphi. See what's happening behind events OnCreate, OnActivate, OnShow, OnClose...
Here's how to save a web page displayed inside a WebBrowser (TWebBrowser component) as a raw HTML file or into a single (MHT) file (MHTML format: web archive - single file) programmatically using Delphi.
Here's how to show the contents of a MEMO (textual BLOB) field in a TDBGrid. Plus: how to enable editing of a TMemoField's contents using a separate window.
The MD5 Message-Digest algorithm is a cryptographic hash function. MD5 is commonly used to check the integrity of files. An MD5 hash value is a 32 digit hexadecimal number. Using Delphi, you can easily create a function to calculate the MD5 hash for a given file.
The TStopWatch Delphi class implements a very accurate process execution timer and provides a set of methods and properties that you can use to accurately measure elapsed time.
Whispering about reverse engineering Delphi applications: 'I have a Delphi program's .exe, can I decompile it and get the source?'. Page 2.
Learn about records, Delphi's data structure that can mix any of Delphi's built in types including any types you have created.
Working with common dialog boxes: Open and Save. How to create my own Notepad using Delphi. Part 1.
Learn how to send the WM_CopyData message between two Delphi applications to exchange information and make two applications communicate. The accompanying source code demonstrates how to send a string, record (complex data type) and even graphics to another application.
Exchanging Data over the Network using Delphi. An introduction to sending data over the network using Delphi and Indy. The article focuses on sending / receiving record data and raw (binary) data using TCP connections.
Adding components to a DBGrid. How to place just about any Delphi control (visual component) into a cell of a DGBrid. Find out how to put a CheckBox, a ComboBox (drop down list box), a DateTimePicker (calendar) and even an Image inside the DBGrid.
Placing Delphi applications in the System Tray in easy steps. The perfect place form programs that are left running for long periods of time with no user interaction.
When programming an event handler in Delphi (like the OnClick event of a TButton), there comes the time when your application needs to be busy for a while, e.g. the code needs to write a big file or compress some data. If you do that you'll notice that your application seems to be locked. Your form cannot be moved anymore and the buttons are showing no sign of life. It seems to be crashed. Application.ProcessMessages might come as a rescue, but you need to know its dark side!
A Beginner’s Guide to Delphi Programming: Chapter 1. What is Borland Delphi? Where to download a free version, how to install and configure it.
An overview of creating and using 'Borland Package Libraries' and how they compare with 'Dynamic Link Libraries' in creating smaller Delphi applications.
Screen RULER allows you to precisely measure anything on your computer screen. If you need to determine width and/or height of any object on your screen, Screen RULER is the tool to use. Transparency, units in pixels and millimeters and screen snapping are some of the features.
Generics, a powerful addition to Delphi, were introduced in Delphi 2009 as a new langage feature. Generics or generic types (also know as parametrized types), allow you to define classes that don't specifically define the type of certain data members. Get ready to use Generics.
When creating Delphi database applications that are to be run on various machines, the connection to the data source should not be hard-coded in the executable. This article (with the sample project) shows how to store database connection parameters (server and database name) in Registry and how to build the ConnectionString dynamically.
TColorButton - button with color properties. Full source code of the TColorButton Delphi component, an extension to the standard TButton control, with font color, background color and mouse over color properties.
In a Delphi event handler, the Sender parameter indicates which component received the event and therefore called the handler. Find out how to exploit the powers of the Sender parameter: share event handlers and more.
Most often when programming in Delphi you don't need to dynamically create a component. If you drop a component on a form, Delphi handles the component creation automatically when the form is created. This article will cover the correct way to programmatically create components at run-time.
If you are up to creating a rock solid (OOP driven) Delphi application in a way that your code is maintainable, reusable, and flexible the OOP nature of Delphi will help you drive the first 70% of your route. Defining interfaces and implementing them will help with the remaining 30%.
Need to highlight the row behind the mouse cursor in a DBGrid? Here's how to select (make active record) and highlight (change color, font, etc.) a row in a DBGrid as mouse moves around the grid.
TreeView with check boxes and radio buttons. Here's how to add check boxes and radio buttons to a TTreeView Delphi component. Give your applications a more professional and smoother look.
Here's how to store (and retrieve) a record (structure) value into a BLOB field in Delphi database applications.
DBGrid with MultiSelect. Multiple row selection in Delphi DBGrid - providing the ability to select multiple records within the grid. A Beginner's Guide to Delphi Database Programming: Appendix A.
How to add menu items to a Menu (or Popup menu) at run-time, how to respond to the OnClick event. Plus: how to extend the TMenuItem to hold custom string property.
Reading and writing to text (ascii) files using Delphi code. Find out how to read a line by line of a txt file and how to write some data back to the file.
Delphi For Beginners: Extend Delphi's built-in types by constructing your own types.
How to obtain a computer's IP address by using the Socket API and Delphi's Pascal.
Chapter seven of the free Delphi Database Course for beginners. Take a look at how you can take advantage of the TADOQuery component to boost your ADO-Delphi productivity.
One of the keys to traditional Windows programming is handling the messages sent by Windows to applications. Handling Windows Messages the Delphi way!
A free network (Internet / intranet) traffic (download / upload) monitor. Network traffic monitor allows you to quickly and easily examine the network usage of the local computer. Full Delphi source code included.
Overview of dbExpress, along with a collection of tutorials and articles on building database applications using this data access technology.
Taking a look at the use of standard HTML tags and elements and the use of server-side HTML controls - from a perspective of a Delphi developer.
Preparing to code with no barriers. See how to overcome the compiler version problem: compiling Delphi code for various Delphi versions.
Here's an idea for your next application: create a
Web Forms navigation in ASP.NET - Part 1. Exploring navigation techniques between Web Form pages: postbacks, direct navigation (using the <a> tag) and code-based navigation (using Server.Transfer and Response.Redirect).
Understanding and using Borland Delphi Class procedures / functions. What they are and how to find a practical use for them.
Extending Delphi functions and procedures with default (optional) parameters and method overloading.
If you want to control the flow of code execution depending on what the program has already done or what it has just encountered you need to use one of the two Delphi Pascal branching statements: if statements and case statements. Learn how.
Here's how to place an image into a cell of a TDBGrid. Enrich the visual presentation of data in Delphi database applications.
Concise descriptions of Delphi versions and its history, along with a brief list of features and notes. Find out how Delphi evolved from Pascal to a RAD tool that can help you deliver high-performance, scalable applications ranging from desktop and database solutions to mobile and distributed applications for the Internet not only for Windows but also for Linux and the .NET.
To speed up data processing, for example, fetching data from the database to create reports, you can add an additional thread to fetch and operate on the result (recordset). Learn about the traps in writing Multithreaded Delphi Database Queries with dbGo (ADO).
A Simple example of Artificial Intelligence using Delphi. The article explores Delphi approach to AI, using the pebble picking game. A simple game is used to show how computer can learn by correcting mistakes.
A collection of 'Powered by Delphi' logos. Place them on your Web site, your Delphi application splash-screen, about box, help, documentation, and anywhere else you think it might be appropriate.
Constructing 'multiple document interface' application with Delphi. Examining MDI parent/child relationship, menus and some most important MDI parent form properties.
Delphi organizes applications into what is called projects. A project is made up of the visual interface along with the code that activates the interface. Each project can have multiple forms, allowing us to build applications that have multiple windows. Find out about Delphi's Project File in this article!
What to keep in mind when scaling Delphi applications (forms) on different screen resolutions.
Full Delphi source code to a simple Chat application. Learn how UDP (User Datagram Protocol) broadcast can be used to find partners with unknown IP addresses in the network.
An overview of VCL components allowing you to access a MySQL database from Delphi using standard data controls without using BDE/ADO/ODBC. Plus a few MYSQL related tools.
More sophisticated Mouse techniques. Is mouse Present? Handling OnMouseEnter, OnMouseLeave. Restrict movement, Set Position, Faking clicks, etc.
Everything you ever wanted to know about DLLs and Delphi but didn't know where to look for answers (or were to afraid to ask)
Controlling the number of application instances. In this article you'll learn how to 'run-once enable' a Delphi application that can check for its previous (running) instance. Along the process, several techniques of implementing such a check will be discussed; as well as how to bring your already running application to the foreground, if a user tries to run it 'one more time'. By the end of the article you'll have a copy-to-go code to control the behavior of your application's multiple instances: with the option to limit the number of running instances.
Implementing PING without using raw sockets. Implementing Internet pings using Delphi and the Icmp.dll.
A selected collection of open source, free, and commercial Delphi components to help you add ZIP / UNZIP functionality to your application. Compressing and deflating files and directories in well-known formats like ZIP, RAR, TAR, GZIP, CAB will not longer be a missing piece in your Delphi projects!
Creating a console mode application with Delphi; a text-mode program that runs without a graphical interface. Even more: see how to capture the output of a console application in a GUI Delphi program.
For StringGrids with simple content the default drawing action is sufficient, but when various aligns or different colors need to be included in the stringgrid, drawing code must be written in the OnDrawCell event to support owner draw. Owner draw does not need to be specifically set (as one has to with a TListBox), one just places drawing code in the event handler and it is called by the class code after drawing the grid.
Here's how to create an instance of a Delphi form, from its name. Example: if a string 'TMyForm' is provided, a new form of type TMyForm should be created ...
The ADPDBExplorer (About Delphi Programming Database Explorer) application allows you to connect to a Microsoft Access (MDB) database and/or SQL Server / MSDE database to explore a database structure, insert, edit or delete data. Features also include running 'free-hand' queries (select, insert, update, etc.) against the database using a simple query builder. A simple master-details relationships builder allows displaying and operating on joined tables.
Intercepting keyboard input for controls that cannot receive the input focus. Working with keyboard hooks in Delphi.
Have you ever found yourself writing the same code over and over to perform some common task within event handlers? Yes? It's time for you to learn about programs within a program. Let's call those mini programs subroutines.
Create a new Delphi project and drop a TListView (Name: 'LV') component on a form. Add a TButton (Name
Creating XML files from Paradox (or any DB) tables using Delphi. See how to export the data from a table to a XML file and how to import that data back to the table.
Code Completion in Delphi. A Beginner's Guide to Delphi Programming: Chapter 13. It's time to learn how to let Delphi help you code faster: start using code templates, code insight, code completion, shortcut keys, ...
An overview of application development with Delphi, including creating a simple project, writing code, compiling and running a project. Also, find out how to ask Delphi for help.
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. Here's the OnDrawColumnCell event handler for a Delphi DBGrid control to color every second row in a different color.
Borland Delphi 7 Studio: Released! Extra, Extra, read all about it! All about NEW features in the next generation design-to-deploy e-business development tool: Borland Delphi 7 Studio.
Commenting Delphi code. Learn the art of helping yourself, when it comes to code maintenance. The purpose of adding comments to Delphi code is to provide more program readability using understandable description of what your code is doing.
Free online Borland Delphi OOP Course: Chapter Overview.
Unfortunately, building applications includes coding. Regardless of how carefully you write/debug your program, it will be impossible to imagine every situation that can go wrong. Learn how to handle errors and exceptions in Delphi applications.
Let's see how to to show an adobe acrobat (.pdf) file in a delphi application.
Unlike regular .LNK shortcuts (that point to a document or an application), Internet Shortcuts point to an URL (web document). Here's how to create an .URL file, Internet Shortcut, using Delphi.
Learn how to create a powerful 'multiple document interface' application using Delphi. A Beginner's Guide to Delphi Programming: Chapter 11.
Delphi's PosEx function returns an integer specifying the position of the first occurrence of one string within another, where the search starts at a specified position.
class="no-js" itemscope itemtype="http://schema.org/Article" > itemprop="description" >The idea of this
How to locate a TreeView node given by node text using Delphi
How to register (and unregister) OLE controls such as dynamic-link library (DLL) or ActiveX Controls (OCX) files from a Delphi application.
When in the need of storing some content related to your Delphi application on the user's hard disk, you should take care of the support for state separation of user data, user settings, and computer settings.
Delphi's FormatDateTime function formats a TDateTime value to a string.
Creating a console mode application with Delphi; a text-mode program that runs without a graphical interface. Even more: see how to capture the output of a console application in a GUI Delphi program.
The most basic splash screen is just an image (more precisely a form with an image) that appears in the center of the desktop screen when the application is loading (and gets hidden when the application is ready for usage).
Pressing the Tab key moves the input focus to next control and Shift-Tab to previous in the tab order of the form. When working with Windows applications, most users intuitively expect the Enter key to behave like a Tab key.
class="no-js" itemscope itemtype="http://schema.org/Article" > itemprop="description" >Windows messages
Delphi's ExtractStrings function fills a string list with substrings parsed from a delimited list.
When a combo box is in dropped down state Windows draws a list box type of control to display combo box items for selection. When the length (of a string) of items exceeds the width of the combobox, the items are displayed as cut-off! Here's how to ensure all ComboBox items are visible when drop down list is displayed.
With AsyncCalls you can execute multiple Delphi functions at the same time and synchronize them at every point in the function or method that started them. Here's an example project taking advantage of the thread pool implementation with CancelAll and WaitAll.
Having all your background threads running at the same time is not something Windows would be happy with. While Delphi does allow you to easily create a separate thread (by extending the TThread class) it does not provide a thread pool implementation out of the box. The OTL does - here's a sample thread pool for your background tasks implemented in OmniThreadLibrary.
What to keep in mind when scaling Delphi applications (forms) on different screen resolutions. Page 2.
Delphi For Beginners: Interface, Implementation, Initialization, Finalization, Uses and other funny words.
DateTimePicker inside a DBGrid. Here's how to place a TDateTimePicker into a DBGrid. Create visually more attractive user interfaces for editing date/time fields inside a DBGrid - place a drop down calendar into a cell of a DBGrid.
Delphi's Copy function returns a substring of a string or a segment of a dynamic array.
Accessing protected members of a component. Many Delphi components have useful properties and methods that are marked invisible ('protected') to a Delphi developer. In this article you will find the workaround to this problem - thus enabling you to access a DBGrid's RowHeights property, for example.
Delphi's LeftStr function returns a string containing a specified number of characters from the left side of a string.
In Delphi, the if statement is used to test for a condition and then execute sections of code based on whether that condition is True or False. Watchout for If Then Else traps if you are a beginner using nested if statements.
Drop down list inside a DBGrid - part 1. Here's how to place a drop down pick list into a DBGrid. Create visually more attractive user interfaces for editing lookup fields inside a DBGrid - using the PickList property of a DBGrid column.
Here's how to store TTreeView component items to XML (preserving the Text and other properties of a tree node) and how to populate a TreeView from an XML file.
Streams, streams, ... TStream. A stream is what its name suggests: a flowing river of data. A stream has a beginning, an end, and you're always somewhere in between of these two points. Learn about using the TStream class in Delphi: how to use stream objects to read from, write to, or copy information stored in a particular medium.
Delphi provided Runtime Type Information (RTTI) more than a decade ago. Yet even today many developers aren't fully aware of its risks and benefits. This article provides an overview of the RTTI usage in Delphi for Win32.
Working with binary files from Delphi. Use Delphi to manage writing, reading and updating your own types of files.
Need to create, encrypt or manage PDF (Portable Document Format) files from Delphi? Using the tools and components in this listing you will get powerful control of PDF documents in your applications. PDF is a worldwide standard for electronic documents. It was originally developed by Adobe.
Customizing the DBNavigator. Enhancing the TDBNavigator component with modified graphics (glyphs), custom button captions, and more. Exposing the OnMouseUp/Down event for every button.
Placing a TProgressBar into a TStatusBar. Here's how to add a status bar (or any other Delphi component) to a progress bar. Provide visual feedback of application's lengthy operation in the status area of a Delphi form.