1. Technology
Send to a Friend via Email

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

Advanced Delphi Windows / Shell / API / Graphics / OLE Programming

A simple understanding of Delphi is fine when you create applications for home use. Once you start building real-world applications you'll start looking for ways to solve more complex tasks - and Delphi will have all the answers!
  1. OLE / COM / Automation (34)
  2. Graphics Programming (36)
  3. Sound / Speech / Animation (5)
  4. Shell programming (17)

Understanding Memory Allocation in Delphi
When you start programming in Delphi you might get errors like "stack overflow". What is stack? How is memory managed in your Delphi programs? What is heap? Why do you not have to create instances of record types? Why do local variables have weird initial values?

Receive Windows Messages In Your Custom Delphi Class - NonWindowed Control
Windows messages are a key ingredient in communication between Windows and (your) applications and also in communication between (two) applications. For an application to receive a Window message, the application must provide a "window" a message will be sent to. What is you do NOT have a window to receive a message? What if you want to handle...

Holiday Greetings With Windows Regions and Stars
Rectangles are boring. Here's an article describing windows regions and explaining how to use them to produce a star-shaped form. Stars display "Happy Christmas" in various languages.

Snap The Mouse To The Default Button in a Dialog Box in Delph…
Unfortunatelly for your Delphi application users, the "move pointer to the default button in dialog boxes" feature is not handled by your Delphi application. The mouse pointer will not jump for Delphi dialog boxes like InputBox, MessageBox, ShowMessage or any custom made modal form / window. Here's a quick fix.

Creating Windows Service Applications Using Delphi
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.

Load a DLL From a Resource Directly From Memory in Delphi Applications
To use a DLL stored inside a Delphi application executable file, the DLL first needs to be stored on the file system. Does it? Here's how to load a DLL from a resource directly into memory and use it without saving it to the hard-drive.

Static vs. Dynamic Dynamic Link Library Loading - A Comparison
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.

The TStopWatch Delphi Class Implements a Very Accurate Process Execution Timer
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.

Design Your Delphi Program in a Way That it Keeps its Memory Usage in Check
When writing long running applications / processes (the kind of programs that will spend most of the day minimized to the task bar or system tray), it can become important not to let the program 'run away' with memory usage. Clean up memory used by your Delphi program using the SetProcessWorkingSetSize Windows API function. Learn how...

Delphi Data Exchange - How do You Communicate Data Between Two Delphi…
There are many situation when you need to allow for two applications to communicate. Maybe you need to check how many instances of an application are running. Maybe you need to exchange application specifc data between application instances. Maybe one application needs to "wait" until other application finishes some task... What's your practice?

Where and How do you Store your Delphi Application Configuration Data?
While using INI files to store application specific configuration data is a piece of cake in Delphi, INI files are simple text files - and everyone could mess up the information inside using a simple Notepad. How about storing configuration data in a binary format using a more OOP like style?

Serialize / Stream (Read/Write) Configuration Settings
Learn how to save published properties of a class into a stream / file and read back. Use it to store your Delphi application specific configuration data.

THook Delphi Class with Source Code
Put shortly, a hook is a function you can create as part of a dll or your application to monitor the 'goings on' inside the Windows operating system. Hooks.pas ensures hooking in Delphi applications is easy.

Allow your Delphi Forms to Accept Dropped Files from Window Explorer
While drag and drop is implemented in the VCL, to accept files from dragged from the Windows Explorer you need to handle a few shell api messages. Here's how to accept files dropped from the Windows explorer to a Delphi application.

Get the Active (Focused) Control Outside of your Delphi application
When a user is working within your application, to grab the (handle of the) active control - the one with the input focus, you can simply use Delphi's "Screen.ActiveControl" property. Let's say you need to display something like a hint window below the currently active control - you would need to know the bounding rectangle (TRect) of this control that is not inside your application. Here's how using Delphi.

Close Previous Application Instances / Ensure One Instance Running
If, for whatever the reason, you need to terminate the running instance(s) of your application when the user decides to start a new instance, you need to find a mechanism to notify all the running instances (and optionaly) close them. This article shows you one such mechanism when using Delphi.

Display a TopMost System Modal Message Box
If you really want to grab the user attention and stop him from doing anything else, you need to be able to display a system-modal topmost message box even when your application is not active. Here's how when using Delphi.

Display a Password Dialog when Restoring a Delphi Application from the TaskBar
Suppose you have a data-critical type of application where you would not want a non-authored user to work with the data. What if you need to display a password dialog *before* the application is restored to make sure an authorized user is accessing it? Here's how to do it in Delphi.

Display a LogIn Dialog Before the Main Form of an Application is Created
If you need to implement some kind of authorization for your Delphi application you might want to display a login / password dialog *before* the main form is created and displayed to the user. In short, the idea would be to create, display, and destroy the "login" dialog before creating the main form. Here's how.

Delphi IDE Add-In: Simple About Delphi Programming RSS Reader
With the "Current Headlines" Delphi IDE Add-In you can get the About Delphi Programming RSS feed without even leaving the Delphi IDE. Full source code for a simple Delphi IDE menu wizard included!

Listening to the Clipboard: Clipboard Delphi Spy with Custom Clipboard Formats
Extending the clipboard's flexibility and functionality from Delphi. Taking control over the Clipboard with custom formats. Coding Delphi to receive clipboard change notifications.

Intercepting Keyboard Input with Delphi - Implementing a Keyboard Hook
Intercepting keyboard input for controls that cannot receive the input focus. Working with keyboard hooks in Delphi.

Understanding and Using Windows Callback Functions in Delphi
Simply put, a callback function is a routine in your program that Windows calls. A good example of a Windows API functions that require callback functions are enumeration functions. LEarn how to use Windows Callback in Delphi applications.

Creating, Parsing and Manipulating XML Documents with 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.

Drag a Delphi Form Without the Caption Bar
No title bar! How can we drag such a window? It's easy and fun: let's make a Delphi form move by clicking (and dragging) in it's client area.

Creating and Using DLLs from Delphi
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.

Customizing the System Menu
What if you want to add a custom item to the system menu of an application, or delete/change the default Close caption, or even add some bitmap to it? This article shows how to handle (add, delete, change, add bitmap,...) your own system menu items and how and where to process them, by using Windows API and Delphi.

Create a Windows Start-Up Manager
How to build a program (using Delphi) that allows a user to control which applications will run when Windows starts up. Full source code (heavily documented) included.

How to Create a Windows Shortcut (.LNK) File from Delphi Code
Creating a standard Windows shortcut file from Delphi.

How to Send Information (String, Image, Record) Between Two Delphi Applications
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.

Executing and Running Applications and Files from Delphi Code
Executing and Running Applications and Files from Delphi Code.

How to Hook the Mouse to Catch Events Outside of your Delphi application
Learn how to track the mouse activity even when your application is not active, sits in the Tray or does not have any UI at all. By installing a system wide (or global) mouse hook you can track what the user is doing with the mouse and act accordingly.

An introduction to working with Windows Registry from Delphi applications
Some basic facts on using Delphi and the Windows Registry database.

DLLs Made Simpler
This article is aimed at removing the fear of writing DLLs for beginners. A lot of beginners think DLLs are really complex, when actually they are pretty simple

Retrieving volume's (disk / drive) serial number
Here is a handy piece of Delphi code to read the serial number of a (disk) drive.

A guide to developing Delphi programs in Windows API (without the use of the VCL
A guide to developing Delphi programs in Windows API (without the use of the VCL). Free online programming course for intermediate/advanced Delphi developers. Focus on raw Windows API programming.

Message in the Bottle
One of the keys to traditional Windows programming is handling the messages sent by Windows to applications. Handling Windows Messages the Delphi way!

Tips, tricks and code samples
Using API calls to get the low level Windows functionality: working with fonts, drives, processes, etc

"The Big Brother" Delphi code toolkit
Going undercover: hiding from the task list, disabling task-switch, removing from the TaskBar, disabling shut down, ...

Computer restrictions with Delphi and Registry
How to enable your applications to make restrictions to what users can (and cannot) do with their computer using Delphi and the Registry.

Sending messages to non-windowed applications
Learn how to send messages (signals) to non-windowed applications by using AllocateHWND and DefWindowProc. In this article we also briefly describe what Delphi does in the background to intercept Windows messages, how can we write our own message handler for a windowed application and how to obtain a unique message identifier that we can safely use in our applications.

An introduction to hook procedures
This document describes what Windows hooks are and how to use them within a Delphi application.

Disk in drive A:
Some useful routines when working with floppy disk and Delphi.

Get and Set Display Device Modes
Changing the display mode settings (resolution and color depth) from Delphi code.

Hey Windows, Call me!
Let Windows work for you: implementing function callbacks with Delphi. Project: list all windows in Windows.

Monitoring Registry Changes
Need to get notified about changes to the attributes or contents of a specified Registry key? Them you are ready for: Part 4 to your 'Big Brother' Delphi code toolkit.

NO GUI Delphi applications
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.

Touch Me - I'm Untouchable
Intercepting keyboard input for controls that cannot receive the input focus. Working with keyboard hooks from Delphi.

Virtual Key Codes
Symbolic constant names, hexadecimal values, and keyboard equivalents for the virtual key codes used by Windows.

Sticky Windows
How to dock your Delphi forms to the edges of your desktop screen.

Resource Files Made Easy
How Delphi uses standard Windows-format resource files. Bitmaps, icons, cursors and more.

Registering DLL and ActiveX controls from code
How to register (and unregister) OLE controls such as dynamic-link library (DLL) or ActiveX Controls (OCX) files from a Delphi application.

Retrieving volume's (disk / drive) serial number
Here's a handy piece of Delphi code to read the serial number of a (disk) drive.

Delphi and Registry
Some facts on using Delphi and Windows Registry database.

Locate, Display and Execute Control Panel Applets
Interested in Delphi code to mimic the Windows Control Panel folder behavior? In this article you can learn how to find CPL files, how to extract description, name and even the applet icon. Even more, learn how to execute applets from your applications.

Hardware I/O Port Programming with Delphi and NT
Delphi I/O Port Programming under NT and an I/O Port Map Manipulator driver

Hook: Capture keys in all Windows applications
How to capture keypresses in all applications that are runing in Windows.

Project Jedi
  Project JEDI's paramount goal is to extend Delphi's native access to the Windows API by translating C/C++ headers of popular but as yet unsupported technologies into Delphi interface units.

VCL secrets and the practical use of the Win32 API
This paper introduces you to a number of under-the-hood techniques in Delphi as well as how to achieve a number of goals using the Win32 API. The Delphi RTL and VCL are rich in under-used facilities, many of them undocumented anywhere but the source.

A Closer Look at the TRect Windows Data Type.

©2014 About.com. All rights reserved.