Delphi Notes

Useful website:

Even better tip website: Torry Delphi

Delphi Basics Website - excellent site for critical info (the documentation that should be included with Delphi!)

Converting Integers to Strings:

Use "IntToStr" from the SysUtils unit.

  uses SysUtils;
  aString := IntToStr(i);

To play a sound file:

uses MMSystem;


Delphi Threads

To create a thread use File; New; Other; ThreadObject - this will create a unit that encapsulates your thread class.

A thread class has the following functions and procedures:

Sleep(DWORD) - Win32 API procedure to pause a thread for the specified number of milliseconds.

GetThreadTimes can be used to get timing information for a thread (when created, exit time, kernel time and user time).


To Execute an external application use the Windows API "ShellAPI" to provide "ShellExecute":

  ShellExecute(handle, operation, filename, parameters, folder, show command);



  ShellExecute(Form1.Handle, nil, 'c:\windows\notepad.exe','c:\windows\general.txt', nil, SW_SHOWMAXIMIZED);

ShellExecute spawns a separate process (thread) for the application so it runs in parallel with your Delphi application that executed it.

If it fails it will return a longword error code between 0 to 32 (or if higher is the handle of the other application). Try RaiseLastWin32Error() (part of SysUtils) for more error info.

See: or

sw_Hide 0
sw_ShowNormal 1
sw_Maximize 3
sw_Minimize 6
sw_Show 5