                             Delphi Tips & Tricks

Below are a list of tips and tricks that I have run across on the
various newsgroups relating to Borland Delphi.  I have slightly editted
these articles to remove unnecessary quoting, etc.  However, these tips
are untested and may not all work as written.

Tips & Tricks:

access.txt   - how to connect your Delphi application to an Access 2.0
               database.
               Lance Leverich

appblock.txt - how to create a program that blocks the user from
               accessing other running programs.
               The Nomad

assert.txt   - a Pascal version of the assert C macro to aid debugging.
               Duncan Murdoch, Lester Kovac, Jay Cole

atan2.txt    - the atan2 function.
               Nathan Dreon, Terje Mathisen, Jon Jenkins

avisize.txt  - how to determine the playback size of an AVI movie.
               Hans Hill

basicstr.txt - example code for accessing and using Visual Basic string types.
               The Nomad

bmpindex.txt - description of a database indexing technique called Bitmap
               Indexing, which can greatly enhance look-up performance.
               Dan Stevens

canvas.txt   - how to create a TControlCanvas for non-window controls.
               The Nomad

cdtrack.txt  - how to determine which track the current CD is on.
               Mark Barr

clipbrd.txt  - how to put a memory stream onto the clipboard.
               Mark R. Johnson

cmpnts.txt   - how to access the components a given component owns.
               Mark Johnson

colorstr.txt - how to translate a TColor numeric value to a descriptive
               string (ie. "clSilver" or "clWindow").
               The Nomad

comm.txt     - a component for serial communications.
               Fred Bulback

comm2.txt    - how to solve problems with the TComm component (comm.txt).
               John Peterson, Carl Mes

cputype.txt  - a unit to detect the CPU type, modified from Intel's code.
               Ray Lischner

cursor.txt   - how to force the mouse cursor shape to update immediately.
               The Nomad

cursors.txt  - how to create and register your own custom cursors.
               Timothy Barr, Per Bakkendorff

dates.txt    - how to store and manipulate dates and times in Delphi.
               Martin Liesen

dbgrid.txt   - a TDBGrid descendant that shows images.
               Bill Raike

dbgrid2.txt  - a component derivative of TDBGrid that exposes Col, Row, and
               Canvas properties as well as the CellRect() method.
               Brian Murray

delay.txt    - a Delphi equivalent for the Turbo Pascal Delay() function.
               Nivaldo Fernandes

deldos.txt   - how to compile a DOS executable (.EXE) with the Delphi
               command line compiler (DCC.EXE).
               Eric Nielsen, Kevin Smith

dll.txt      - how to prevent multiple instances of DLL objects.
               David Stidolph

dosenv.txt   - example code for accessing DOS environment variables in Delphi.
               Claude Pellerin

dragctl.txt  - how to implement drag and drop of controls.
               The Nomad, Mark Duncan

dropcmbo.txt - how to make a TComboBox drop open.
               John N. Miller, Luis de la Rosa, Scott Anderson

dynarray.txt - how to declare the size of an array at run-time.
               Allan Lochert

elastic.txt  - how to build a panel that is resizeable at run-time.
               Dion Kurczek

endsessn.txt - how to trap the wm_EndSession message and properly shut down
               your application when exiting Windows.
               Hallvard Vassbotn

except.txt   - how to implement global exception handling.
               Cees Binkhorst

exewait.txt  - how to execute another program and wait for it to complete.
               Ben Licht

exitwin.txt  - how to force Windows to exit and/or restart.
               J. Stephen R. Silber

exppath.htm  - how to expand a path to a TOutlineNode given the index.
               Christian Feichtner

filecopy.txt - a function for copying a file, preserving its timestamp.
               David Stidolph

filedate.txt - how to copy a file and set its date & time stamp.
               Jon Lowe, Ben (benl@panix.com)

filedrag.txt - how to implement file drag & drop from File Manager.
               Mark R. Johnson, John N. Hodges

findcomp.txt - how to access a component based on a name formed with variables
               at run-time.
               rcram@knoware.nl

floats.txt   - how to use floating point types in components.
               Sven Lindhardt

floatwin.txt - a unit to make a captionless window moveable.
               Anders Ohlsson

floatwn2.txt - a much simpler implementation of floating windows.
               Steve Teixeira

getclass.txt - how to get to class information dynamically via GetClass().
               Marc Palmer

getnext.txt  - how to use the GetNextChild() method of a TOutlineNode.
               Clifford Stabbert

gettext.txt  - how to use the GetText() method to retrieve the full text
               buffer of a TStrings property or TMemo control.
               Mark Johnson

gettoken.txt - code for breaking strings into individual tokens for parsing.
               Thomas Scheffczyk

gpharray.txt - how to quickly copy a 2D array to an image.
               Paul Sullivan, Stephen Warrior

grabdesk.txt - how to capture the Windows desktop to a form.
               Craig Francisco

graphres.txt - how to use bitmaps stored in a resource file.
               Mark R. Johnson, Brad Stowers

gridclr.txt  - how to change the color of a row or column in a grid.
               Luis de la Rosa

helpsrch.txt - how to open Windows Help directly to the Search dialog.
               N.FERNANDES@conservation.org

hideapp.txt  - how to hide an application from Task Manager.
               Darnell Cruz

hidettl.txt  - methods to hide and show a form's title bar on the fly.
               Claus Ziegler

hscroll.txt  - how to activate the horizontal scrollbar of a listbox.
               Railton Frith

hugearr.txt  - how to allocate a huge (>64KB) array in Delphi.
               Jon Jenkins, David Stidolph

iconup.txt   - how to force a form's icon to update while minimized.
               Terence Goggin

incptr.txt   - how to increment pointers (from GetMem and GlobalAlloc/
               GlobalLock).
               Marten Larsson

io-redir.txt - a unit to redirect Input & Output through TCustomEdit
               derivatives (TEdit, TMemo, etc.).
               Kiriakos Vlahos

isdelphi.txt - how to determine if the Delphi IDE is running.
               Wade Tatman

loadlib.txt  - how to link in a DLL routine at run-time via LoadLibrary.
               Ben Licht

lzcopy.txt   - how to copy and uncompress files using the LZExpand API.
               J. Stephen R. Silber

lzexpand.txt - how to decompress files using the LZExpand API.
               Bruce Laurent Laimer

maxsize.txt  - code to control the Maximized size of a form.
               Ben Licht

mdititle.txt - how to kill the title bar of an MDI child.
               The Nomad, Andy McFarland

memopos.txt  - how to determine the line & column position of the cursor
               in a TMemo.
               <xsf@aol.com>

menubmp.txt  - how to add a bitmap to a menu item.
               Kurt Claeys

menuitem.txt - how to respond to a dynamically created menu item.
               The Nomad

messages.txt - an example of how window messages can be used when Delphi
               events are not enough.
               Mark R. Johnson

metafile.txt - a unit for displaying and manipulating Windows metafiles.
               Rene Post

moricons.txt - how to make more than one icon available for a program.
               Brad Stowers

move32.txt   - Assembler code for a 32-bit move operation.
               David Stidolph

multires.txt - how to make a form appear consistent at many resolutions.
               Brien King

multirs2.txt - how to make forms appear consistent across multiple
               resolution displays.
               Micheal Novak

nbkpages.txt - code to add and delete pages from a TNotebook at run-time.
               Mark R. Johnson

netinfo.txt  - a unit and several procedures for extracting network user
               information from a Novell network.
               Sajan Thomas

netscape.txt - how to form a DDE link with a Netscape Web browser.
               Kerry Podolsky

newwing.txt  - a unit for accessing the Win-G graphics library that fixes
               several Delphi/Win-G problems.
               Eric Nielsen

nextctl.txt  - how to shift focus to the next control in the tab order.
               Neil Dholakia, Randall Siler

nobeep.txt   - how to keep Delphi from beeping on ENTER in a TEdit.
               Robert Wahler

notebook.txt - how to dynamically add controls to TTabbedNotebook or TNotebook.
               Mark R. Johnson

palettes.txt - example code for creating logical color palettes.
               Marten Larsson

palette2.txt - how to properly respond to the wm_QueryNewPalette and
               wm_PaletteChanged window messages.
               bfschler@cat.syr.edu

pchar.txt    - an excellent description of how to work with PChars in Delphi.
               Martin Liesn

previnst.txt - a unit for activating the previous instance of an application.
               Scott May, Anders Ohlsson

previns2.txt - how to switch focus to an existing instance of an application
               instead of creating a new instance.
               Tim Gooch, Marco Cant

progman.txt  - how to access Program Manager via DDE.
               Frantzcy Paisible, Michael Caracena

propinfo.txt - an example of how to dynamically retrieve property values.
               The Nomad

qbf.txt      - a unit showing how to implement Query By Form (QBF) and Search
               By Form (SBF) services in Delphi.
               Rick Rutt

realmode.txt - code to access real mode memory areas.
               Leopoldo F. Saldanha

scrnsavr.txt - how to make a screen saver with Delphi.
               Thomas W. Wolf

scroll.txt   - how to automate memo/window scrolling.
               The Nomad

search.txt   - a bug fix for the search.pas text search function of the
               TextDemo project.
               Pete Royston

segments.txt - a unit for accessing the memory between A000-FFFF.
               Jeremiah Gilbert, Pybe Faber

sendkeys.txt - how to do the equivalent of VB's SendKeys.
               Steve Teixeira

setbound.txt - how to design a new control that catches and/or limits
               changes to Left, Top, Width, Height, and BoundsRect.
               Mark R. Johnson

settime.txt  - how to set the system time & date in Delphi.
               Khaled Alakhras

share.txt    - how to access shared files (i.e. via SHARE.EXE).
               Mark Johnson

slimtab.txt  - an example of how to cut down on the resources used by a
               complex TTabbedNotebook.
               Jon Jenkins

splitwin.txt - how to make a split window with adjustable split.
               Scott May

srchstr.txt  - sample code for string pattern matching.
               David Stidolph

subclass.txt - how to subclass an existing window to intercept its window
               messages.
               Lance Leverich

sysmenu.txt  - how to add menu items to an application's system menu.
               jciriell@physiology.uwo.ca

tabenter.txt - how to make the ENTER key behave like the TAB key in Delphi.
               Curtis White, Simon Callcott

tline.txt    - some thoughts on how to create a line control and responding
               to the cm_HitTest VCL control message.
               Allen Bauer, The Nomad

toolbar.txt  - how to make a toolbar that does not cause the main form to be
               deactivated when a toolbar button is clicked.
               The Nomad

tparser.txt  - a description of the TParser VCL object and how it is used.
               Ray Lischner

transblt.txt - how to draw bitmaps with transparent areas.
               Mark R. Johnson

trim.txt     - a unit to trim spaces from strings.
               Bob Swart, Pierre Tourigny

trim2.txt    - another unit to trim spaces from strings.
               Joseph Bui

trim3.txt    - a third unit to trim spaces from strings -- take your pick.
               Bob Swart

tstream.txt  - how to read/write text data to a file using TStream.
               Michael Vincze

tstream2.txt - how to read/write objects to a file using TStream.
               Mark R. Johnson

tstream3.txt - how to read/write components to a file using TStream (includes
               saving a form's layout).
               Mark Johnson

varargs.txt  - a program to demonstrate use of type-safe variable number of
               parameters in Delphi..
               Hallvard Vassbotn

vbtypes.txt  - where to find functions to deal with Visual Basic types.
               Steve Teixeira

vcsdll.txt   - how to hook into the Delphi IDE's menus & version control.
               Bryan Slatner

win-g.txt    - a WinG (ftp://ftp.microsoft.com/developr/drg/WinG/) import unit
               for Borland Pascal.
               Sean Palmer, Lars Fosdal

wrapgrid.txt - a grid component that allows you to use a TStringGrid, but also
               wrap the text in a cell.
               Luis de la Rosa

NOTE:  If you try any of these tips and find mistakes, or an article you
wrote appears here that you prefer did not, send e-mail to me at
keeper@mindspring.com, and I will take care of it.

keeper@mindspring.com
Copyright 1995 Mark R. Johnson.  This is a CITY ZOO production.
Last revised July 5, 1995.
