Delphi Tips
This section of the site contains 169 useful Delphi related hints and tips. Choose or search for a tip below.
- A general purpose Base64 decoding routine using Indy
- Adding component help to Delphi
- Animate tray application windows as they open and close
- Animate windows as they are opened and closed
- Auto-resizing and centring forms on screen
- Boyer-Moore-Horspool text searching
- Calling CreateProcess() the easy way
- Check if an HTML element is displayed
- Check that a HTML document has completely loaded
- Communicate between processes using windows messaging
- Communicate with Windows Program Manager using DDE
- Convert between long and short file names
- Delete files with the ability to undo or recycle
- Detect if an application has stopped responding
- Different ways of executing applications and files from Delphi
- Display the Browse for Folder dialog box
- Drawing disabled text
- Drawing outlined text
- Drawing rotated text
- Encrypt and decrypt functions
- Execute a DOS command and capture the output
- Execute a program and wait until it is done
- Extract keywords from an HTML document
- Fast string file searching
- File Open/Save Common Dialog Control IDs
- Find the position of the text cursor in a memo control
- Find the taskbar and system tray window handles
- Finding HTML elements by ID in a TWebBrowser document
- Force a TEdit to accept only numeric input
- Get the network computer and domain names
- Getting and setting the user and system environment variables
- How can I add my own custom menu item to another application?
- How to access the Registry using Windows API
- How to add a context menu item to Windows Explorer
- How to add an OnMouseDown event to a TPopupMenu
- How to add text completion capability to a TComboBox
- How to adjust RGB values using TTrackBars
- How to blend two pf24bit images using ScanLine
- How to block input to the system until released
- How to call CopyFileEx and let the callback update a progress bar
- How to call Internet Explorer from Delphi
- How to centre text in a TEdit
- How to centre text in a TEdit (alternative approach)
- How to change the corner size of RoundRect
- How to change the drag cursor image when dragging in a TTreeView
- How to check if a key is pressed
- How to check if a string is a number
- How to check if a TTreeView is fully expanded or collapsed
- How to check if the BDE is installed
- How to compare two pf24bit images
- How to control the scroll buffer of a TMemo
- How to convert a *.bmp file to a *.jpg file
- How to convert an integer value to a Roman Numeral representation
- How to convert Delphi forms from binary to text and vice versa
- How to convert hex colour values into Delphi formatted ones
- How to convert TDateTime to a UNIX timestamp and vice versa
- How to copy data between TWebBrowsers
- How to copy multiple files into one
- How to create a borderless TComboBox
- How to create a brush using CreateBrushIndirect
- How to create a non-rectangular TPanel
- How to create a pie chart
- How to create a resizable TPanel with a size grip
- How to create a TCheckBox with a transparent caption
- How to create a TComboBox with incremental search capabilities
- How to create a TEdit that accepts only numeric input
- How to create a TGroupBox with a checkbox that disables / enables all contained controls when checked
- How to create a TListBox that is resizable at runtime
- How to create a TListBox with Drag and Drop capabilities
- How to create a TMemo with alternating colours to paint the lines
- How to create a TScrollBar with a background bitmap
- How to create a TScrollBox with its own background
- How to create a TTreeView with a three state checkbox
- How to create a TTreeView without scrollbars
- How to create components with a transparent background
- How to create gradient colour schemes
- How to create multiline hints
- How to create non-hiding hints
- How to define a minimum size for a component
- How to delete files with wildcards
- How to delete lines from a text file
- How to detach and re-attach an event
- How to detect text and font size changes
- How to determine the screen resolution
- How to determine the track of the current CD
- How to disable form movement using the mouse
- How to draw dotted or dashed lines using a pen with a width greater than 1
- How to empty a TImage
- How to enable scrollbars at design time
- How to expand a TMemo while keying in
- How to extract the title of an HTML document
- How to flash the taskbar
- How to generate a circle through three points
- How to generate a temporary file name
- How to get a screen shot of a control
- How to get data from a file without reading it into memory
- How to get the physical caret position in a TMemo, TEdit or TRichEdit
- How to get the RGB value of a pixel under the mouse cursor
- How to get the size of a file
- How to get the size of a text file without opening it
- How to get the system's colour palette
- How to have a form that never activates
- How to implement a 'Lasso'
- How to implement a multi-line caption on a TButton
- How to implement an OnMouseDown event for the buttons of a TRadioGroup
- How to implement autocompletion in a TEdit
- How to implement drag and drop at design time
- How to know if the mouse has entered the component area
- How to make a child form listen to broadcasted messages
- How to make a TCollectionItem contain a TCollection
- How to mix or separate three color channels
- How to paste files from Windows Explorer into your application
- How to perform a Shell Sort
- How to prevent a TListView from displaying tool tips for long items
- How to prevent a TWebBrowser from displaying a document's background
- How to print text and text files in Delphi
- How to programmatically make your programs run on Windows startup
- How to read bitmap file information
- How to read image pixels fast
- How to read the installed ADO version
- How to read Unicode text files
- How to read very large text files fast
- How to reduce the number of Set methods in a component
- How to refresh file icons
- How to register a global hotkey
- How to replace text in a Word document
- How to resize a *.jpg image and save the result to a file
- How to resize a TPanel at runtime
- How to resolve a host name
- How to retrieve rich text from a resource file and save it to disk
- How to save and load printer settings to / from the registry
- How to save and restore font selections to a text file
- How to save several TBitmaps into one file
- How to save the canvas of a TPaintBox to a .bmp file
- How to search for a pattern in a file
- How to send a message to a specific control on a TForm
- How to set boundaries for newly created controls
- How to snap a window to the screen edge
- How to tell Netscape Navigator which web pages to load from your Delphi program
- How to trap the ALT key state in a visual component
- How to turn numlock on by code
- How to use a function or a procedure as a parameter to another function
- How to use a scroll event in a TListBox
- How to use a TControlCanvas in a component
- How to use the alpha transparency features included in Windows 2000 and later
- How to write a list of strings to the registry
- Incremental search of list box
- Inserting RTF code into a rich edit control
- Install components and IDE extensions into the Delphi IDE
- Making LMD buttons work when clicked
- Merging files
- Message box that works with a Delphi Service Application
- Move the mouse cursor from code
- Open documents and URLs in their associated applications
- Prevent flicker on graphics controls
- Prevent system sleep
- Print any type of document using Delphi
- Programatically log users off
- Reading and writing INI files
- Remove recently opened projects from the CodeGear RAD Studio IDE welcome page
- Right align main menu items
- Scanning MS Office documents using the MS Anti-virus API
- Search for help
- Serialize application settings
- Solution for problem with auto update feature in Rad Studio 2010 and Win Vista/7 UAC
- Triggering default menu items from code
- Using the TStrings.ValueFromIndex property
- When was that file last accessed?
- Which COM objects to use?
Some tips have been written especially for the site while others have been gathered from across the internet. All are believed to be in the public domain.
Where the author and/or source of a tip are known the appropriate credits are given. If you are the author of a tip and don't want it to appear here please let me know and I'll remove it. Alternatively let me know who you are and I'll credit you.
If you can't find what you are looking for here you can also try the Code Snippets Database.
The tips have not been tested and you use them entirely at your own risk.
Keep Up To Date
Get news of updates as they happen. Subscribe to the
Tips News Feed
You can also get an occasional summary of new and updated tips and other changes by joining the Delphi Tips Mailing List.
