Installing Delphi 7 on Windows 7/8/10/Server 2012

| category: My notes | author: st
Tags:

How to install and use Delphi 7 and help files on Windows 8/10 or Server 2012.

Installation

Start Delphi setup and install all required items including help files.

In Windows 8/10/Server 2012 or later (should work on Windows 7 too):

  • Create the shortcut to Delphi32.exe
  • Open …

Watching heap memory usage in Free Pascal/Delphi

| category: Testing | author: st
Tags: ,

Free Pascal (like Delphi) provide some useful functions to watch heap memory state in your application.

function GetHeapStatus: THeapStatus;

THeapStatus is documented here

Example of using this function is below

program ProgWatchMem;

uses
  Math, FGL;

type
  TLongIntArr = array of LongInt; // LongInt is a 4-byte signed integer
  PLongIntArr = ^TLongIntArr;
  TMySortedMap = specialize …

Delphi/Free Pascal: very simple "old school" mutex

| category: Programming | author: st
Tags: ,

The code below show how to implement very simple but cross-platform "old school" mutex (mutually exclusive semaphore)

interface

type
  TMutex = class
  private
    FFileHandle: integer;
  public
    constructor Create(const AName: string; const WaitForMSec: integer = 10000);
    destructor Destroy; override;
  end;

implementation

uses
  Classes, SysUtils, DateUtils,
  {$IFDEF MSWINDOWS}
  Windows
  {$ENDIF};

function GetTempDir: string …