Useful Delphi packages
  1. 1. PNGImage (TPNGObject)
    1. 1.1. Adding PNG support to Delphi IDE
  2. 2. MD5
  3. 3. ZLib compression
  4. 4. DIUcl compression
  5. 5. FastShareMem
  6. 6. FastMM4
  7. 7. SimpleXML
  8. 8. lkJSON
  9. 9. Delphi PCRE
  10. 10. ZIP archive manipulators
  11. 11. CPU Usage – adCpuUsage.pas
  12. 12. ID3v2
  13. 13. TFakeDLL
  14. 14. CryptoAPI – Ported WCrypt2

Seeing in the statistics that many people search for TPNGObject and other stuff I’ve decided to write this download page-article with direct links to useful 3rd party packages I use dialy in my Delphi 7 projects.

All classes are freeware and open source (licenses included). Links are provided for classes I remember the source I’ve got them from. Most packages work well below Delphi 7.

See also my standalone Delphi 7 eXtension library.

PNGImage (TPNGObject)

Download PNGImage (also called PNG Delphi and TPNGObject) is a fully-blown PNG image support for Delphi. Its main class is TPNGObject which inherits from standard TGraphics and thus can be used the same way standard TJPEGImage, TBitmap and other image classes are used.

The archive contains help file, 4 Delphi units and a set of required .obj files. PNGImage in itself is standalone.

Adding PNG support to Delphi IDE

Here’s a brief description of how to make Delphi IDE recognize .png images as well as it recognizes .bmp or .jpeg. You need to create a package (or use dclusr.dpk from Delphi7\bin), Add pngimage.pas there and Install the package (or Build if it’s already installed).

Now in any project you want to use a PNG picture in, say, TImage component you just need to enable your package (by default it’s enabled – make sure it’s checked in Project → Options → Packages list) and then all TPicture properties will gain the ability to use PNG images in the same way they use any other TGraphics-derived class.

Note that it won’t work for components like TSpeedButton which use specific graphics classes – like TBitmap. You’ll need to write your own control supporting TGraphics or TPNGImage or use mine (from Delphi 7 eXtension library) – I’ve already made one for speed buttons, it’s called TPNGSpeedButton and has several other useful properties.

MD5

Download MD5 hasher – standalone and concise Delphi unit. Includes functions for calculating MD5 hashes of strings, streams, files and buffers as is easy to use:

pascalShowMessage(MD5String('Hellow, world!'));   // => 199852cea7a5cf52f6c1627a9fa7e08b

ZLib compression

Download Delphi ZLib 1.23 – ZLib library for Delphi. This is a set of built .obj files built with C. Contains ZLibEx.pas and ZLibExGZ.pas (GZIP-compatible compression) units which link those .obj and provide useful wrapper functions and classes like these:

DIUcl compression

Download DIUcl 1.4 (homepage) is a lossless data compression algorithm with extremely fast unpacking but quite slow packing. It’s used in a well-known UPX packer.

This library is written in ANSI C and the archive contains .obj files with Delphi unit wrappers, help file and a dozen of demos.

UCL’s authors are serious guys (or just one?..) who have "designed and implemented one of the on-board lossless data compressors of the NASA Mars Exploration Rovers". They have several more compression libraries on their open source page.

FastShareMem

Download FastShareMem 2.10 – replacement for standard ShareMem Delphi unit; lets you avoid the requirment for borlndmm.dll when building Delphi DLLs. It’s said to work faster than standard unit as well although I haven’t been much into profiling it although I did test it a lot when building my plugin-driven programs.

FastMM4

Download FastMM4 (homepage) is a fast replacement memory manager for Borland Delphi Win32 applications that scales well under multi-threaded usage, is not prone to memory fragmentation, and supports shared memory without the use of external .DLL files. I haven’t used it but as far as I know it’s quite good and is to be used in large-scale projects.

SimpleXML

Download SimpleXML is a quick XML procession library that loads XML files into its own DOM framework, lets you alter it and save the result in a normalized form. It’s written by a Russian programmer and is contained within a single unit.

Unless I’m mistaken I’ve heard that it’s used in more recent Embarcadero Delphi versions.

The archive includes a help file, demo project and Delphi 5 support layer.

lkJSON

Download lkJSON 1.07 is a JSON processing library building DOM from the source and encoding it back into a string. The archive contains several demo projects.

Delphi PCRE

Download Perl-Compatible Regular Expressions (used in PHP, for example; see also PCRE.org). I haven’t used it but it’s kept in my archive since I might need it one day.

This is an OOP Delphi wrapper for pcre.dll library built with Visual C++ (see the readme).

ZIP archive manipulators

Download a collection of Delphi ZIP units – hkset, unzdll, unzip and others.

CPU Usage – adCpuUsage.pas

Download CPU usage measuring unit for early Delphi’s (2-5) and Borland C++ Builder but supposedly working for Delphi 7 as well.

Credits (file_id.diz):

CPU Usage Measurement routines for Delphi and C++ Builder

Compatible with Windows 95/98/NT/2000

Version:      1.02
Creation:     Jul 8, 2000

Author:       Alexey A. Dynnikov
EMail:        <hidden>
WebSite:      http://www.aldyn.ru/

ID3v2

Download unit for for reading and writing ID3v2 tags for Delphi 5-6 (but apparently working for Delphi 7 too). It’s fairly small (under 500 lines) and comes with a demo app.

If you need ID3v1 reader you can get it here.

Credits (Info.txt):

ID3v2.pas
Tested with Borland Delphi 5 & 6

{ *************************************************************************** }
{                                                                             }
{ Audio Tools Library (Freeware)                                              }
{ Class TID3v2 - for manipulating with ID3v2 tags                             }
{                                                                             }
{ Copyright (c) 2001 by Jurgen Faul                                           }
{ E-mail: <hidden>                                                            }
{ http://jfaul.de/atl                                                         }
{                                                                             }
{ *************************************************************************** }

TFakeDLL

This is an interesting unit that lets you load libraries directly from memory and use them without saving to disk. It simulates standard Windows PE loader – fixes relocs and other stuff and then gives you an object with functions that you can use similar to GetProcAddress.

It’s more than 10 years old so I don’t know if it works on Vista+ but in case you want to check it out download it here.

Credits (Readme_rus.txt):

+------------------------------------------+
|                                          |
|   TFakeDll v1.1 (Beta 2) by Dr.Golova.   |
|                                          |
+------------------------------------------+

== by Dr.Golova [mailto: <hidden>] =========================== 01.06.02 ===
== [c] Underground Information Center [ http://www.uinc.ru ]===============

CryptoAPI – Ported WCrypt2

Download CryptoAPI with demo application. This is an official port of WinAPI’s WCrypt2.h that features cryptographic routines. With its help the included demo app is able to compute MD2, MD4, MD5, SHA1, SHA256 and some other hash sums.