Programming in Delphi

Delphi interfaces for Windows API to:
Multilingual Delphi programs Inspect and unpack InnoSetup archives
 

Delphi interface to Windows Task Scheduler 2.0

Since Windows Vista a new version of the Task Scheduler is implemented. In addition to the features of the former version some new options are available, like running a task after a scheduled start was missed or the use of user accounts without passwords. The Windows API provides several new functions to integrate the Task Scheduler with user programs.
To make this easier to the Delphi programmer, I developed several units which encapsulate the functions of the Windows Task Scheduler 2.0 into Delphi objects. To demonstrate the integration of these objects into own code, a sample program (new in August 2020) is included to the package.

Note: The implementation is not complete. But all functions to create and edit time schedules for user applications are available.

Download:

Version 2.0.1 (March 2023)

 

Delphi interface to Windows Volume Shadow Copy Service (VSS)

This service was first introduced in the Microsoft operating system Windows XP and extended by several additional features in Windows 7,8 & 10 and Windows Server 2008/2012. It exploits the possibility of making snapshots using the NTSF file system, enabling even files that are blocked by running processes to be copied. The snapshot copies are stored at elsewhere in the file system and retained for as long as the snapshot lives, during which time they can easily be backed up.

The use of Volume Shadow Copies is described in detail in the Microsoft Software Development Kit for Windows 7. As an example, you can find there a program (VSHADOW.EXE) and the appropriate source code. This, as well as the required interfaces (header files) to the system libraries, is however written in C++. To use VSS under Delphi, it is first necessary to convert the header files into a Delphi unit (VssApi.pas in the provided source package). A second unit (VssUtils.pas) contains all routines from the Microsoft sample program converted to Delphi. To facilitate the integration into user written programs, all functions are bundled to a class (TVolumeShadowCopy). For execution in an own thread, another class (TVssThread) is provided. A sample snippet how integrate this into a user program can be found in the readme.txt file which is part of the source package.
Finally, the package provided contains the converted main part of the application example as a console application (VsToolkit). This application is not based on the original Microsoft sample, but on the modified version Volume Shadow Copy Simple Client (VSCSC). All programs and routines can be compiled for 32- and 64-bit systems (the latter requiring at least Delphi XE2).

Notes: The routines provided will perform most of the functions needed for backups, but a restore is not to date supported.
Running the program requires administrator rights.

Downloads:

Version 2.3.3 (March 2022)

 

Delphi interface to Windows Portable Devices (WPD)

If you connect a smartphone to a Windows computer, the content is not integrated into its file system, as is the case with USB storage devices, for example. The reason for this is that such devices are connected via the Media Transport Protocol (MTP) To access the content, you need the functions of the Windows-Portable-Devices-Interfaces (WPD).

The units required to integrate the WPD functions into your own Delphi programs are not yet part of the system libraries. I have therefore created the following units to enable access to the files of a device connected via MTP in my own Delphi programs:

Downloads:

Version 1.1 (November 2023)

 

GnuGetText for Delphi

GNU Gettext for Delphi founded by Lars B. Dybdahl is a system for providing a Delphi application with a multilingual user interface. After a short period of familiarization, you can work very efficiently with it. It also offers the great advantage that no Delphi development environment needs to be available to create a translation, so that every user has the option of translating into their own language. All you need is a simple text editor or, better still, the following specially developed editor programs:

The basis for all translations is always a Delphi application, preferably written in English.
Note: The programs described below can also be used for Embarcadero C++ Builder.

The translations are created in two steps:

  1. Creation of a text file (po file) with the English phrases as a template for the translations.
  2. Merging an existing translation into another language with the updated template.

Parts that have already been translated are automatically adopted when the program is updated, so that the effort required to update the translation is kept to a minimum. The two required programs are called up in Windows Explorer via the context menu:

1. Right-click on a directory   2. Right-click on a po file
will create the template (po file).   will merge template and translation and start PoEdit for post-processing.

The program for creating templates (ggdxgettext.exe) has been slightly extended:

Also the other programs from the original package were revised:

Important note: If a translation with ggassemble.exe is to be embedded in an exe file created with Delphi, it is important that the appropriate GnuGetText.pas unit from the download offered here is used in the Delphi source texts of the project.

New user interface GgtTranslate

The integration in the form of context menus is certainly very practical for sporadic editing of individual translations. However, when creating a multilingual program (e.g. in English, German and other languages), using it in this way can be a bit tedious, especially if the texts still need to be continuously adapted. You have to constantly change directories and only reach your destination after several mouse clicks.
The program GgtTranslate, which combines all the steps for each project, even for several languages, under one user interface, provides a remedy here. It uses the same settings (dxgettext.ini) as the original programs, but allows all steps to be carried out immediately one after the other:

  1. Extract the strings in the original language (usually English) from the source texts (pas and dfm files) and create a translation template.
  2. Merging this template with the selected translations
  3. Edit ignore.po with a text editor
  4. Edit the translations and create the mo files, e.g. with PoEdit
  5. Copy the generated mo files to the relevant language directory: e.g. <directory of the exe file>\locale\de\LC_MESSAGES\
  6. Embedding the translations in the executable files

In addition the current version 3.1 also offers the following additional options:

Utility programs

In addition, some auxiliary programs for editing po files are provided:

Downloads:

Delphi 10 version of GgtTranslate Version 3.1.1 (2024-04-10):

ggt-translate-setup - Program package with all the additional programs and extensions listed above (9.96 MB)
dxgettext-setup - Program package with original functions from DxGetText in updated form (5.89 MB)
Gnu GetText manual Source code of all described programs (3.98 MB)

Original version of DxGetText:

GNU gettext for Delphi (5.2 MB)
Note: This version is from 2008 and no longer runs under Windows 11. The above package dxgettext-setup is recommended as replacement.


Inspect and unpack InnoSetup archives

If you want to inspect an InnoSetup archive or extract its files, you can use the console application Inno Setup Unpacker. For easier handling you can download a Windows-GUI for this below.

The executable setup to be processed can be loaded via a file selection dialog, just by drag & drop, using the command line or by an entry in the Windows context menu for exe files. Immediately after opening, the basic file info and the list of included files are displayed. To extract files, just click the appropriate button and select the destination directory. Optionally, a filter can be specified to extract only the matching files. Inno Setup files up to version 6 are supported.

Command line (optional):
InnoUnpack setupname [Options]
  setupname Name of InnoSetup archive
  /d:destdir Directory for unpacked files
  /f:filter File filter
  /m Process internal embedded files
  /s Extract files without paths
  /a Process all copies of duplicate files
  /o Overwrite files
  /la:xx Language selection (xx = en, de, fr, it or hu)

Downloads:

Windows InnoUnpacker 1.9.2 (January 2024) (Languages: English, German, French, Italian and Hungarian) - suitable for install packages created with InnoSetup 5 and 6

Unicode version of the console application Inno Setup Unpacker - for Inno Setup 2.0.7 to 6.2
This version can be used as replacement for innounp 0.50 to fix Unicode issues.