More Programming Articles Page 7

  • GetFiles

    How to recusively list all files in directories.procedure GetFiles(Result: TStrings; Path: string; IncludePath: Boolean = False); var R: Integer; SR: TSearchRec; ...
  • Get size of a large file

    How to get the size of a very large file.function GetFileSize(const FileName: string): Int64; var SizeLow, SizeHigh: DWord; hFile: THandle; begin Result := 0; ...
  • Delphi version of VB DateAdd

    A Delphi implementation of a useful VB functiontype TDateAddUnit = (daYears, daMonths, daDays); function DateAdd(ADate: TDateTime; Quantity: Integer; AUnit:...
  • Day of year

    How many days since start of yearfunction DayOfYear(ADate: TDateTime): Integer; var FirstDate: TDateTime; YYYY, MM, DD: Word; begin DecodeDate(ADate, YYYY, MM,...
  • StretchDraw an image to a printer canvas

    Stretch drawing a graphic to a printer.canvas is very poor. Here is a better solution.procedure DrawImage(Canvas: TCanvas; DestRect: TRect; ABitmap: TBitmap); var ...
  • Header file format of Interbase/Firebird files

    A simple class to get information about the disk structure of an interbase/firebird database.This simple class will allow you to specify an interbase/firebird database...
  • Network connection present ?

    How to check if a network connection is present.GetSystemMetrics has information on networking function NetworkPresent: Boolean; begin Result :=...
  • How To Get the exe name from a Window Handle

    How to get the exe file name when given a window handle.uses ..., enumStuff; function WindowToExe(window: dword) : string; var pid : dword;     pl : TProcessList;...
  • Using TObjectList

    Making life easier with TObjectListNew to Delphi 5 & 6 is the TObjectList. As it's name implies it's capable of storing a list of objects! Recently I was required to...
  • Stop <Input type="password"> from prefilling

    Stop users using the autocomplete features of browsers to remember their passwords.Recently we realised that a number of our users were using the...
  • Local Routines or Nested Routines

    How to declare Local routines in delphi ?It is possible to declare local procedures or Functions within a procedure or function. Though it seems some how unusual at...
  • Getting Parameter Values - Updated

    Getting parameter values with delphi is extremely easy, you have the ParamStr and ParamCount functions to work with, also there is FindCmdLineSwitch function which...
  • Component writing, part 3

    This article is the final part of a three part article on components. This final part will cover property / component editors, how to write dedicated editors for your...
  • Adding events to a TList.

    Adding a procedural type to a TList, or TStringListHere is the code I used to achieve it: unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics,...
  • Deleting all records in a table without SQL

    A simple way in DelphiIn Delphi, all versions, we have a component called TTable. We can use a method of that component to delete all the records in a table. Note that...
  • Tables, fields, and foreign keys

    A complicated SQL query I had to work out to tell me information about the current database.This query will tell you TableName, FieldName, FieldType, FieldSubType,...
  • Component writing, part 2

    This article will cover how to write advanced properties, how to write custom streaming for those properties, and sub-properties. This article originally appeared in...
  • Getting the computers DNS server

    Code for retrieving the computers DNS server that works on Windows '9x/ME and 2000/XP, independent of IpHelper API, etc.I have seen postings on various newsgroups and...
  • The Methapone Algorithm

    A phonetic algorithm such as soundex only optimized for the english languageA description of the metaphone algorithm is available at this page also there is the double...
  • Windows systems dialogs

    The windows dialogs that microsoft forgot to documentMost of us have seen these dialogs in windows and most ms programs here is a way to get in touch with most of...
  • Getting a filesize

    GetFileSize provides no way to turn a filesize into a descriptive string, this algorithm doesfunction GetAFileSize(SizeInBytes: Integer): String; const Preffixes:...
  • Parsing URI's

    A fast and easy way to parse URI's as seen on commercial librariesNOTE: if you have a Internet library then you already have URI parsing functions, however this may...
  • Wrapper around systemparametersinfo

    A easy way to know system parameters, change them, et alBasically windows gets/sets system information via systemparametersinfo, for instance when you go to the...
  • Getting notifications from the shell

    How to hook to the shell internal event triggeringIf you have ever needed to know when the shell issues an event here is a wrapper around SHChangeNotifyRegister wich...
  • Rolling up a form

    The standard behaviour for double clicking a title bar is to maximize/restore the form. The following class changes the double click action to add a new effect which...
  • Component writing, part 1

    First in a three part series covering component writing in Delphi. This article originally appeared in Delphi Developer Copyright Pinnacle Publishing, Inc. All rights...
  • How can i access properties of classes by name?

    How can i access properties of classes that are not implemented via the uses-clause, just knowing their names?You have to use the TypInfo unit. Simple properties, like...
  • Sending E-mail with attachment using outlook.

    How to send e-mail with attachment using Outlook.The whole demo stuffs (*.dpr,*.pas etc) are in the MailDemo.Zip. The unit that can do the job is scratched below: unit...
  • Is user Administrator

    How to determine if the current user is logged in as an administrator. Author unknown.const SECURITY_NT_AUTHORITY: TSIDIdentifierAuthority = (Value: (0, 0, 0, 0,...
  • Set Date/Time

    How to set the Windows Date and Time. Author unknown.Type TOSType = (os95, os98, osOSR2, osNT4, os2K); procedure SetDateTime(dDateTime: TDateTime); var dSysTime:...
  • Embedding files as resources in a Delphi executable

    You can learn how to create your own software for any situation with the excellent Software Requirements Unleashed.  If you need to know how to embed icons, cursors,...
  • Delphi 6 Personal Edition FAQ

    Frequently asked questions about this edition and its licensing termsDELPHI 6 PERSONAL EDITION FAQ Why did they call it Personal? Because its license limits you to...
  • Moving rows and columns of a StringGrid by code

    Making MoveColumn and MoveRow public without installing a new componentMoving rows and columns of a StringGrid by code The user can move rows and columns of a...
  • Preventing the user from selecting text in a Memo control

    Setting Enabled to False has some undesirable side-effects...Preventing the user from selecting text in a Memo control The easiest way would be to set the Enabled...
  • Update Tables with Data from Other Tables with Local SQL

    The UPDATE sentence of Local SQL (the SQL used by the BDE) doesn't support JOIN...so how do you update a table with data from another table?Here's how: +-------------+...
  • Splitting a string in an dynamic array

    A function that splits a string in parts separated by a substring and returns the parts in a dynamic string arraySplitting a string in an array The following functions...
  • Splitting a string in a string list

    A function that splits a string in parts separated by a substring and returns the parts in a dynamic string arraySplitting a string in a string list The following...
  • Copy, inherit or use?

    The three ways to use forms in the the Objects RepositoryCOPY, INHERIT OR USE? Code reusability saves us time and effort, increasing our productivity. Object-oriented...
  • Calling IDispatch directly

    How to incorporate simple scripting capabilities into Delphi. It might prove useful to call a method, described as string, on an interface, defined by a string...
  • Custom Containers Pack (CCPACK 5)

    Review of this freeware expert that helps you visually build composite componentsCUSTOM CONTAINERS PACK (CCPACK 5) What is Custom Containers Pack? CCPack 5 is a...
  • Hyphenation

    A simple hyphenation algorithm (syllabicates Spanish words)Hyphenation Sometimes we need to display or print a text, and we'd like to hyphenate long words that don't...
  • Validating email addresses in Delphi

    Is an email address valid?Validating email addresses in Delphi Nowadays it's very common that our programs store email addresses in databases as part of the data of...
  • Counting occurrences in a string

    A function that returns the number of times a substring occurs in a string. There's also an ANSI version.Counting occurrences in a string The following functions...
  • Sorting a TListView by the column clicked by the user

    How to sort a ListView in ascending or descending order by a given column?Sorting a TListView by the column clicked by the user We want the following behaviour for a...
  • Making a form "always visible"

    How to make a form always visible staying on top of other formsMaking a form always visible To make a form always visible above other forms either belonging to the...
  • Looking for text in any part of a field

    A function to search text in part of a field of any datasetLooking for text in any part of a field The following function searches for text in any part of a field of...
  • Password component

    A component for generating temporary passwords.Contributor: APOGEE INFORMATION SYSTEMS (*******************************************************************...
  • Gregorian / Julian dates

    Convert back and forth between Gregorian and Julian dates.Contributor: GREG VIGNEAULT {DF> I need an accurate method of converting back and Forth between   >...
  • Adaptive Huffman Coding

    LZH implementation in PascalContributor: DOUGLAS WEBB Unit LZH;  {$A+,B-,D-,E-,F-,I+,L-,N-,O-,R-,S-,V-} (*  * LZHUF.C English version 1.0  * Based on Japanese...
  • Print directly

    How to print directly to the printer.Contributor: JAVIER CELUCE A two months ago Gareet Wilson answer this question and I tested that work fine... The best way I have...