Delphi implementation dynamic Get version information

Source: Internet
Author: User
Tags versions

The presence of file version information makes it easy for the application to install files correctly, and enables the installer to analyze the current installation state of the file. Typically, the version information should include a number of important elements, such as the version numbers of the file, the description of the file function, and the author of the file.

At the application level, programmers can determine whether a file should be installed by saving the version information in the application file or the dynamic link library file, and determine the current installation file conflict. After the file has the version information this attribute, the program that we write can realize the following functions:

1. Avoid installing older versions of the same components on new versions of components;

2. In a multilingual system environment, the operating system determines the correct language to use when starting a program based on the language information provided in the file version information;

3. Can prevent the installation of multiple copies of files under different paths;

4. When the application is running, it can determine whether the version of the file is correct;

5. Displays the version number of the executable file in the application's About dialog box;

6. Online upgrade program can determine whether a file because the version is too old, so that the necessary file upgrade.

Because of the congenital defects in the design of Windows system, the FSO used does not support the version information function of the file. To manage version information for a file, Microsoft provides software developers with a way to manage version information in the platform SDK (the Platform Software Development Kit) through APIs (programmable interfaces). These APIs are GetFileVersionInfo, GetFileVersionInfo, Verfindfile, Verinstallfile, and VerQueryValue, They are stored in the next dynamic link library file named VERSION.DLL in the Windows system directory.

Any file that can contain Windows resources in a Windows system can contain version information, such as dynamic link library files, executables, font files, and so on. The version information is packaged into a versioninfo-structured resource that is packaged into these files through the compiler.

This article attempts to explain the use of these APIs separately, to the reader in Delphi through the programming method, how to achieve the runtime dynamic access to the program file version information function.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.