Tips & Tricks
These tips are now available for download as tips.zip
(148K)
Access* - how to connect your Delphi application
to an Access 2.0 database. (Lance Leverich)
AppBlock - how to create a program that
blocks the user from accessing other running programs. (The Nomad)
Assert - a Pascal version of the assert
C macro to aid debugging. (Duncan Murdoch, Lester Kovac, Jay Cole)
ATan2 - the atan2 function. (Nathan Dreon,
Terje Mathisen, Jon Jenkins)
AVISize* - how to determine the playback
size of an AVI movie.
(Hans Hill)
BasicStr - example code for accessing
and using Visual Basic string types. (The Nomad)
BMPIndex* - description of a database
indexing technique called Bitmap Indexing, which can greatly enhance look-up
performance. (Dan Stevens)
Canvas* - how to create a TControlCanvas
for non-window controls.
(The Nomad)
CDTrack* - how to determine which track
the current CD is on.
(Mark Barr)
ClipBrd - how to put a memory stream onto
the clipboard.
(Mark R. Johnson)
Cmpnts* - how to access the components
a given component owns.
(Mark Johnson)
ColorStr* - how to translate a TColor
numeric value to a descriptive string (ie. "clSilver" or "clWindow"). (The
Nomad)
Comm - a component for serial communications.
(Fred Bulback)
Comm2* - how to solve problems with the
TComm component (comm.txt). (John Peterson, Carl Mes)
CPUType - a unit to detect the CPU type,
modified from Intel's code.
(Ray Lischner)
Cursor* - how to force the mouse cursor
shape to update immediately.
(The Nomad)
Cursors - how to create and register your
own custom cursors.
(Timothy Barr, Per Bakkendorff)
Dates* - how to store and manipulate dates
and times in Delphi.
(Martin Liesen)
DBGrid - a TDBGrid descendant that shows
images. (Bill Raike)
DBGrid2* - a component derivative of TDBGrid
that exposes Col, Row, and Canvas properties as well as the CellRect()
method. (Brian Murray)
Delay - a Delphi equivalent for the Turbo
Pascal Delay() function.
(Nivaldo Fernandes)
DelDOS* - how to compile a DOS executable
(.EXE) with the Delphi command line compiler
(DCC.EXE). (Eric Nielsen, Kevin Smith)
DLL* - how to prevent multiple instances
of DLL objects. (David Stidolph)
DosEnv - example code for accessing DOS
environment variables in Delphi. (Claude Pellerin)
DragCtl - how to implement drag and drop
of controls.
(The Nomad, Mark Duncan)
DropCmbo - how to make a TComboBox drop
open.
(John N. Miller, Luis de la Rosa, Scott Anderson)
DynArray* - how to declare the size of
an array at run-time. (Allan Lochert)
Elastic - how to build a panel that is
resizeable at run-time. (Dion Kurczek)
EndSessn* - how to trap the wm_EndSession
message and properly shut down your application when exiting Windows. (Hallvard
Vassbotn)
Except - how to implement global exception
handling. (Cees Binkhorst)
ExeWait* - how to execute another program
and wait for it to complete. (Ben Licht)
ExitWin* - how to force Windows to exit
and/or restart.
(J. Stephen R. Silber, Mike Warot)
ExpPath - how to expand a path to a TOutlineNode
given the index. (Christian Feichtner)
FileCopy - a function for copying a file,
preserving its timestamp.
(David Stidolph)
FileDate - how to copy a file and set
its date & time stamp.
(Jon Lowe, Ben )
FileDrag - how to implement file drag
& drop from File Manager.
(Mark R. Johnson, John N.Hodges)
FindComp* - how to access a component
based on a name formed with variables at run-time. ([email protected], Mark
R. Johnson)
Floats - how to use floating point types
in components. (Sven Lindhardt)
FloatWin - a unit to make a captionless
window moveable -- "floating windows". (Anders Ohlsson)
FloatWn2 - a much simpler implementation
of floating windows.
(Steve Teixeira)
GetClass - how to get to class information
dynamically via GetClass().
(Marc Palmer)
GetNext* - how to use the GetNextChild()
method of a TOutlineNode. (Clifford Stabbert)
GetText* - how to use the GetText() method
to retrieve the full text buffer of a TStrings property or TMemo control.
(Mark Johnson)
GetToken* - code for breaking strings
into individual tokens for parsing. (Thomas Scheffczyk)
GphArray - how to quickly copy a 2D array
to an image.
(Paul Sullivan, Stephen Warrior)
GrabDesk* - how to capture the Windows
desktop to a form.
(Craig Francisco)
GraphRes - how to use bitmaps stored in
a resource file.
(Mark R. Johnson, Brad Stowers)
GridClr - how to change the color of a
row or column in a grid.
(Luis de la Rosa)
HelpSrch* - how to open Windows Help directly
to the Search dialog.
([email protected])
HideApp - how to hide an application from
Task Manager. (Darnell Cruz)
HideTtl - methods to hide and show a form's
title bar on the fly.
(Claus Ziegler)
HScroll* - how to activate the horizontal
scrollbar of a listbox. (Railton Frith)
HugeArr - how to allocate a huge (>64KB)
array in Delphi.
(Jon Jenkins, David Stidolph)
IconUp* - how to force a form's icon to
update while minimized.
(Terence Goggin)
IncPtr - how to increment pointers (from
GetMem and GlobalAlloc/GlobalLock). (Marten Larsson)
IO-Redir - a unit to redirect Input &
Output through TCustomEdit derivatives (TEdit, TMemo, etc.). (Kiriakos
Vlahos)
IsDelphi* - how to determine if the Delphi
IDE is running. (Wade Tatman)
LoadLib - how to link in a DLL routine
at run-time via LoadLibrary.
(Ben Licht)
LZCopy* - how to copy and uncompress files
using the LZExpand API.
(J. Stephen R. Silber)
LZExpand* - how to decompress files using
the LZExpand API.
(Bruce Laurent Laimer)
MaxSize - code to control the Maximized
size of a form. (Ben Licht)
MDITitle - how to kill the title bar of
an MDI child.
(The Nomad, Andy McFarland)
MemoPos - how to determine the line &
column position of the cursor in a TMemo. ([email protected])
MenuBmp - how to add a bitmap to a menu
item. (Kurt Claeys)
MemoItem - how to respond to a dynamically
created menu item.
(The Nomad)
Messages* - an example of how window messages
can be used when Delphi events are not enough. (Mark R. Johnson)
Metafile - a unit for displaying and manipulating
Windows metafiles.
(Rene Post)
MorIcons - how to make more than one icon
available for a program.
(Brad Stowers)
MultiRes - how to make a form appear consistent
at many resolutions.
(Brien King)
MultiRs2* - how to make forms appear consistent
across multiple resolution displays. (Micheal Novak)
NbkPages - code to add and delete pages
from a TNotebook at run-time. (Mark R. Johnson)
NetInfo* - a unit and several procedures
for extracting network user information from a Novell network. (Sajan Thomas)
Netscape* - how to form a DDE link with
a Netscape Web browser.
(Kerry Podolsky)
NewWinG* - a unit for accessing the Win-G
graphics library that fixes several Delphi/Win-G problems. (Eric Nielsen)
NextCtl - how to shift focus to the next
control in the tab order.
(Neil Dholakia, Randall Siler)
NoBeep - how to keep Delphi from beeping
on ENTER in a TEdit.
(Robert Wahler)
Notebook - how to dynamically add controls
to TTabbedNotebook or TNotebook. (Mark R. Johnson)
Palettes - example code for creating logical
color palettes. (Marten Larsson)
Palette2* - how to properly respond to
the wm_QueryNewPalette and wm_PaletteChanged window messages. ([email protected])
PChar - an excellent description of how
to work with PChars in Delphi. (Martin Liesén)
PrevInst* - a unit for activating the
previous instance of an application.
(Scott May, Anders Ohlsson)
PrevIns2* - how to switch focus to an
existing instance of an application instead of creating a new instance.
(Tim Gooch, Marco Cantú)
ProgMan - how to access Program Manager
via DDE.
(Frantzcy Paisible, Michael Caracena)
PropInfo - an example of how to dynamically
retrieve property values.
(The Nomad)
QBF* - a unit showing how to implement
Query By Form (QBF) and Search By Form (SBF) services in Delphi. (Rick
Rutt)
RealMode - code to access real mode memory
areas.
(Leopoldo F. Saldanha)
ScrnSavr - how to make a screen saver
with Delphi. (Thomas W. Wolf)
Scroll - how to automate memo/window scrolling.
(The Nomad
Search - a bug fix for the search.pas
text search function of the TextDemo project. (Pete Royston)
Segments - a unit for accessing the memory
between A000-FFFF.
(Jeremiah Gilbert, Pybe Faber)
SendKeys - how to do the equivalent of
VB's SendKeys. (Steve Teixeira)
SetBound - how to design a new control
that catches and/or limits changes to Left, Top, Width, Height, and BoundsRect.
(Mark R. Johnson)
SetTime - how to set the system time &
date in Delphi. (Khaled Alakhras)
Share - how to access shared files (i.e.
via SHARE.EXE).
(Mark R. Johnson)
SlimTab - an example of how to cut down
on the resources used by a complex TTabbedNotebook. (Jon Jenkins)
SplitWin* - how to make a split window
with adjustable split. (Scott May)
SrchStr - sample code for string pattern
matching. (David Stidolph)
SubClass* - how to subclass an existing
window to intercept its window messages. (Lance Leverich)
SysMenu* - how to add menu items to an
application's system menu.
([email protected])
TabEnter* - how to make the ENTER key
behave like the TAB key in Delphi. (Curtis White, Simon Callcott)
TLine* - some thoughts on how to create
a line control and responding to the cm_HitTest VCL control message. (Allen
Bauer, The Nomad)
Toolbar* - how to make a toolbar that
does not cause the main form to be deactivated when a toolbar button is
clicked. (The Nomad)
TParser - a description of the TParser
VCL object and how it is used.
(Ray Lischner)
TransBlt - how to draw bitmaps with transparent
areas. (Mark R. Johnson)
Trim - a unit to trim spaces from strings.
(Bob Swart, Pierre Tourigny)
Trim2 - another unit to trim spaces from
strings. (Joseph Bui)
Trim3 - a third unit to trim spaces from
strings -- take your pick.
(Bob Swart)
TStream - how to read/write text data
to a file using TStream.
(Michael Vincze)
TStream2* - how to read/write objects
to a file using TStream.
(Mark R. Johnson)
TStream3* - how to read/write components
to a file using TStream (includes saving a form's layout). (Mark R. Johnson)
VarArgs - a program to demonstrate use
of type-safe variable number of parameters in Delphi. (Hallvard Vassbotn)
VBTypes - where to find functions to deal
with Visual Basic types.
(Steve Teixeira)
VCSDLL - how to hook into the Delphi IDE's
menus & version control. (Bryan Slatner)
Win-G - a WinG import unit for Borland
Pascal. (Sean Palmer, Lars Fosdal)
WrapGrid - a grid component that allows
you to use a TStringGrid, but also wrap the text in a cell. (Luis de la
Rosa)