More Programming Articles Page 12

  • Application version number

    How to get the version number of an application at runtimeunit GetVersionInfo;interfaceuses Windows, Classes, SysUtils;procedure GetProjectVersionInfo(AVersionList:...
  • The Infamous "Green Bar" effect

    Output database results in differing coloured tabledata's using the IIF function.<CFQUERY dbtype="ODBC" datasource="Examples"...
  • Format a drive

    This article demonstrates how to format a drive from a Delphi application.procedure FormatDriveDialog; begin ShellExecute(Application.Handle, 'Open', ...
  • Sending files to the recycle bin

    This article shows how to send a file to the recyle bin rather than deleting immediately.unit RecycleBin; interface uses Windows, ShellApi; function...
  • Decimal to roman numerals

    This article demonstrates how to convert a given number to Roman Numerals in Delphi.function DecToRoman ( iDecimal: longint ): string; const aRomans: array [ 1..13 ]...
  • How To Launch the Control Panel

    This article shows how to show the control panel.WinExec('rundll32 shell32.dll,Control_RunDLL',SW_SHOW);
  • Delete a running exe

    This article demonstrates how an exe can delete itself.Under Win32, unless you are running from a removable drive, you cannot delete a running executable. You can have...
  • Show display properties

    This article demonstrates how to show the Display-Properties form of windows.WinExec('rundll32 shell32.dll,Control_RunDLL desk.cpl,,0',SW_SHOW);
  • Path of my DLL

    This article demonstrates how to determine the filepath of a DLL from within the DLL.var Buffer : Array[0..MAX_PATH] of char; begin ...
  • Enable / disable windows start button

    This article demonstrates how to enable / disable the windows start button.To enable: EnableWindow(FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'Button', nil),...
  • Don't minimize secondary forms

    This article demonstrates how to stop all forms in a Delphi app from minimizing when the main form minimizes.For each child form that you wish to remain visible do...
  • How To hog the CPU

    This article demonstrates how to assign more / less CPU time to your Delphi application.var   H: THandle; begin   H := GetCurrentProcess();   SetPriorityClass(H,...
  • CD is audio ?

    This article demonstrates how to determine if the CD inserted is an audio CD or not.procedure TForm1.Button1Click(Sender: TObject); var MyDeviceID : MCIDEVICEID; ...
  • Get the cursor image

    How to draw the current cursor onto an image.I once wrote a component which reflected the cursor (looks nice). Obviously I needed to know what the cursor looks like....
  • IFDEF delphi versions

    How to determine the Delphi compiler version using IFDEF statements.{$IFDEF VER80} {$DEFINE Delphi1} {$ENDIF} {$IFDEF VER90} {$DEFINE Delphi2} {$ENDIF} {$IFDEF...
  • Open / close CD drive

    This article demonstrates how to open / close the CD tray in Delphi.uses MMSystem; procedure TForm1.OpenCdTray(AOpen:Boolean); const DoPlay : array[Boolean] of...
  • Get a list of the fields in a table.

    Get a list of the fields in a table. <cfquery name="getFieldNames" datasource="Examples">   select * from thetablename </cfquery>...
  • Is disk in drive ?

    This article shows how to detect if a disk is in the specified drive.function IsDriveReady(Drive: Char): Boolean; begin Result := FileExists(Drive + ':\nul'); end;
  • Determine CPU speed

    This article demonstrates how to detect the MHZ speed of the current CPU.function GetCpuSpeed: Extended; var t: DWORD; mhi, mlo, nhi, nlo: DWORD; t0, t1, chi,...
  • Icon on the desktop

    This article shows how to add a link on the desktop to your application.Adding a link (lnk) to the desktop directory is pretty simple. First we will need to create a...
  • Days in month

    This article demonstrates how to detect how many days there are in a given month.procedure TForm1.Button1Click(Sender: TObject); var MyDate : TDateTime; tmpStr :...
  • Filter HTML tags out of a string.

    A little RegEx Filter out any HTML tags passed in a string.<cfset MyString = REReplace(MyString, "<[^>]*>", "", "All")>...
  • Hash anyone ?

    This article demonstrates a simple hashing algorythm.function HashElf(const Buf; BufSize: Integer): Integer; var Bytes: TByteArray absolute Buf; I, X: Integer;...
  • Accessing ASP objects in Delphi

    This article demonstrates how to use COM to access ASP objects such as Session.1. Create a MTS object (look under the Multitier page in File->New...)2. Name it...
  • Change numbers in a string to asterisks.

    A little regular expression to change all numbers in a string to asterisks. <cfset MyString = REReplace(MYString, [[:digit:]], *,ALL)> Example: <!--- Fill...
  • Hiding icons on the desktop

    This article demonstrates how to hide all icons on the desktop.var DesktopWnd : HWND; procedure TForm1.Button1Click(Sender: TObject); begin DesktopWnd :=...
  • Autorun CD

    This article demonstrates how to turn AutoRun on / off for your CD drive.procedure TForm1.SetCDAutoRun(AAutoRun:Boolean);const DoAutoRun : array[Boolean] of Integer =...