Delphi Sample Source Code
- Printer
-
VCL
How to Retrieve Printer Information in Delphi: Using DeviceCapabilities, LOGPIXELSX, and Related Techniques
A detailed guide on retrieving printer resolution, paper sizes, and printable areas in Delphi. Includes practical examples using DeviceCapabilities, GetDeviceCaps, LOGPIXELSX, and DMPAPER constants to improve the accuracy and reliability of printing operations.
-
VCL
How to Perform Printing in Delphi: Practical Examples Using TPrinter, Canvas, and TextOut
A detailed guide to outputting text and images to a printer in Delphi, using TPrinter and Canvas. Includes practical source code examples for TextOut, TextRect, bitmap printing, and other essential printing techniques.
- Advanced Usage
-
VCL
Parallel Programming with the TTask Class — Delphi Source Code Collection
A practical guide to parallel programming with the TTask class, explained through sample source code for prime number detection.
- Windows API
-
VCL
Retrieving the Display (Monitor) Scaling Settings in Windows — Delphi Source Code Collection
A sample-based explanation of how to retrieve the display scaling settings in Windows using Delphi.
-
VCL
How to Create a Custom On‑Screen Touch Keyboard in Delphi keybd_event and IME Control Supported
A detailed guide on creating a custom on‑screen (touch‑enabled) keyboard in Delphi, including keybd_event usage, IME control, and CreateParams configuration. Also covers how to handle cases where the default Windows on‑screen keyboard does not appear.
-
VCL
How to Control Clipping and Window Shapes in Delphi Using Regions Guide to CreateRectRgn and CreateEllipticRgn
A detailed guide on using Regions in Delphi (rectangular, elliptical, and polygonal) to perform image clipping and modify window shapes, complete with sample code using APIs such as CreateRectRgn and CreateEllipticRgn.
-
VCL
Creating a Resident Task Tray Application in Delphi Preventing Multiple Instances and Handling TaskbarCreated
A step‑by‑step guide to building a resident task tray application in Delphi, complete with source code. Covers preventing multiple instances, handling TaskbarCreated, processing WM_QUERYENDSESSION, and other techniques for creating a stable Windows background application.
-
String Conversion in Delphi Using LCMapStringEx: Half‑Width/Full‑Width, Hiragana/Katakana, Uppercase/Lowercase
A practical guide to using the Windows API LCMapStringEx in Delphi to convert strings between half‑width and full‑width characters, hiragana and katakana, and uppercase and lowercase. Includes clear explanations and sample code to help you implement reliable text‑conversion features in your applications.
-
VCL
Dragging Windows and Panels in Delphi: How to Use ReleaseCapture and SC_MOVE
A guide to moving forms and TPanels by mouse drag in Delphi’s VCL environment. This article explains how to implement window dragging using the Windows API functions ReleaseCapture and SendMessage(SC_MOVE), along with practical handling of TMouseButton events.
-
VCL
Get the Full Path of Windows Special Folders in Delphi | SHGetSpecialFolderPath Guide
Learn how to retrieve the full path of Windows special folders—such as Desktop, My Documents, and Application Data—using the SHGetSpecialFolderPath API in Delphi. Includes clear explanations and practical sample code.
-
VCL
Opening Windows Explorer with the ShellExecute API in Delphi | Practical Code Examples
Learn how to open Windows Explorer from Delphi using the ShellExecute API—either by opening a specific directory or highlighting a selected file. This guide includes clear explanations and practical sample code.
-
VCL
How to Create a Startup Shortcut (.lnk) in Delphi | Windows Auto‑Launch Implementation Guide
Learn how to create a shortcut (.lnk file) in the Windows Startup folder using Delphi to automatically launch your application at login. This guide explains the process with clear sample code using IShellLink and IPersistFile.
-
VCL
Improving Image Scaling Quality in Delphi with StretchBlt and SetStretchBltMode (HALFTONE)
Learn how to improve image scaling quality in Delphi using the StretchBlt API together with SetStretchBltMode(HALFTONE). This guide explains the differences from TCanvas.StretchDraw, how to work with HDCs, and includes practical sample code.
-
VCL
Controlling Windows with SetWindowPos in Delphi | Z-Order, Topmost, and SWP Flags Explained
Learn how to use the Windows API SetWindowPos in Delphi to control window position, size, and Z-order. Includes examples for topmost windows (HWND_TOPMOST), sending windows to the back (HWND_BOTTOM), non-activating updates (SWP_NOACTIVATE), and a clear overview of common SWP flags
-
VCL
Retrieving Process Lists and Forcibly Terminating Processes — Delphi Source Code Collection
A practical guide showing how to retrieve a process list in Delphi using the QueryFullProcessImageNameW API and forcibly terminate processes with the TerminateProcess API, complete with sample source code.
- TCanvas(TBitmap)
-
VCL, FMX
Drawing on the Delphi Canvas|Sample Code for Shapes and Text Rendering with TBitmap and TCanvas (VCL/FMXL)
A complete guide to drawing shapes and text on the Delphi Canvas using TBitmap and TCanvas. Includes VCL and FMX sample code, FillRect and TextRect usage, TBitmap settings, integration with TImage, and geometric pen techniques.
-
VCL, FMX
Rotate a TBitmap Image and Draw It on a Canvas (VCL & FMX) – Delphi Source Code Examples
Explains how to rotate a TBitmap image around any point at any angle and draw it on a Canvas in both VCL and FMX, with clear Delphi sample source code.
- TDirect2DCanvas
-
VCL
Direct2D Canvas Rendering in Delphi: Controlling Anti-Aliasing and Alpha Blending
A practical guide to using Delphi’s TDirect2DCanvas to implement anti‑aliased rendering and alpha‑blend transparency control. This article explains how to improve the quality of RoundRect and line drawing through proper settings, and includes examples of exporting bitmaps using TImage.
- GraphicEx
-
VCL
How to Display PSD Files in Delphi Installing and Using the GraphicEx Library
To display Photoshop PSD files in Delphi, the GraphicEx library is a practical solution. This article explains how to download and configure GraphicEx, and provides sample source code for rendering PSD images in TImage. It also covers reading layer information and saving bitmaps.
- PDFium
-
VCL
Using PDFium in Delphi: PDF Rendering, Text Extraction, and Image Conversion with Sample Code
A detailed guide on how to use PDFium in Delphi to render PDF files, extract text, and convert pages to images. Includes download sources for the required DLLs and libraries, implementation steps for VCL applications, and complete sample code. Verified to work with Delphi 12 CE
- Registering a System‑Wide Hotkey in Windows
-
VCL
Registering Global Hotkeys in Delphi with RegisterHotKey — Handling WM_HOTKEY and Window Control Examples
Explains how to register system-wide global hotkeys in a Delphi VCL application using the RegisterHotKey API. Covers handling WM_HOTKEY messages, managing IDs with GlobalAddAtom, bringing windows to the front with SetWindowPos, and includes practical code examples.
- Drag-and-Drop Files
-
VCL
How to Receive Drag-and-Drop Files in Delphi VCL — WM_DROPFILES and DragQueryFile Implementation Examples
A detailed guide on how to receive files and folders dragged from Explorer into a Delphi VCL application using WM_DROPFILES and DragQueryFile. Includes sample code, message handling with ApplicationEvents, and methods for displaying dropped files in a ListBox.
-
FMX
Handling Drag-and-Drop Files in Delphi FMX — Implementing WM_DROPFILES and DragQueryFile
Explains how to receive files and folders dragged from Windows Explorer into a Delphi FMX application using WM_DROPFILES and DragQueryFile. Includes sample code, replacing the Window Procedure with CallWindowProc, and displaying dropped items in a ListBox.
- drag file from a Delphi application to Windows Explorer
-
VCL
How to Drag and Drop Files in Delphi VCL — TOleDragPanel and DoDragDrop Implementation Examples
A step-by-step guide to implementing file drag-and-drop in Delphi VCL using the TOleDragPanel class and the DoDragDrop API. Includes sample code demonstrating integration with Windows APIs such as ILCreateFromPath and QueryContinueDrag, along with examples of handling OnDrop events.
- Webview4Delphi
-
VCL
Using the Browser Speech Recognition API from Delphi with WebView4Delphi (WebView2) – Delphi Source Code Collection
A step-by-step guide showing how to use the browser SpeechRecognition API from Delphi via WebView4Delphi (WebView2), complete with sample source code.
-
VCL
Using the Browser Geolocation (GPS) API from Delphi with WebView4Delphi (WebView2) – Delphi Source Code Collection
A step-by-step guide showing how to use the browser Geolocation (GPS) API from Delphi via WebView4Delphi (WebView2), complete with sample source code.
- DSPack
-
Installing DSPack: A Delphi Library for Easily Working with DirectShow
A guide to installing DSPack, a Delphi library that makes DirectShow (for handling webcams and creating videos) easy to use.
- Hardware
-
VCL
Reading and Writing NFC Cards (NXP NTAG215) with PaSoRi and Delphi – Windows Sample Code Collection
This article explains how to read and write NFC cards (NXP NTAG215) using PaSoRi (RC-S380) and Delphi in a Windows environment (winscard.dll and ScardTransmit), with sample code included. While UID can be retrieved from other IC cards as well, this article focuses specifically on NTAG215.
-
VCL
Delphi NFC Programming with PaSoRi (RC-S3800): Read and Write Strings and URLs
Step-by-step guide to using Delphi with the PaSoRi RC-S3800 NFC reader. Learn how to read and write strings, URLs, and UID data from IC cards, with complete source code examples and execution instructions.
-
VCL
Retrieving SMART Data in Delphi|How to Check SSD/HDD Health Status
A step‑by‑step guide on how to retrieve SMART data from SATA‑connected SSDs and HDDs using Delphi, including sample source code. Supports checking drive health status and reading attribute values.
-
VCL
How to Retrieve SMART Information from NVMe SSDs in Delphi|Health Log & IOCTL Usage Example
A guide to retrieving SMART information (Health Information Log) from NVMe‑connected SSDs using Delphi. Includes an implementation example using IOCTL_STORAGE_QUERY_PROPERTY for storage diagnostics on Windows.
