Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8289737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:35:12+00:00 2026-06-08T12:35:12+00:00

I have a small Inno script that checks the registry for you current .Net

  • 0

I have a small Inno script that checks the registry for you current .Net installation and returns a bool…

[Code]
function IsDotNetDetected(version: string; service: cardinal): Boolean;
// Indicates whether the specified version and service pack of the .NET Framework is installed.
//
// version -- Specify one of these strings for the required .NET Framework version:
//    'v1.1.4322'     .NET Framework 1.1
//    'v2.0.50727'    .NET Framework 2.0
//    'v3.0'          .NET Framework 3.0
//    'v3.5'          .NET Framework 3.5
//    'v4\Client'     .NET Framework 4.0 Client Profile
//    'v4\Full'       .NET Framework 4.0 Full Installation
//
// service -- Specify any non-negative integer for the required service pack level:
//    0               No service packs required
//    1, 2, etc.      Service pack 1, 2, etc. required
var
    key: string;
    install, serviceCount: cardinal;
    success: boolean;
begin
    key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + version;
    // .NET 3.0 uses value InstallSuccess in subkey Setup
    if Pos('v3.0', version) = 1 then begin
        success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
    end else begin
        success := RegQueryDWordValue(HKLM, key, 'Install', install);
    end;
    // .NET 4.0 uses value Servicing instead of SP
    if Pos('v4', version) = 1 then begin
        success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
    end else begin
        success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
    end;
    result := success and (install = 1) and (serviceCount >= service);
end;

function CheckDotNet(): Boolean;
begin
    if not IsDotNetDetected('v4\Full', 0) then begin
        //MsgBox('{#gsAppName} requires Microsoft .NET Framework 4.0 Full.'#13#13
        //    'Please use Windows Update to install this version,'#13
        //    'and then re-run the {#gsAppName} setup program.', mbInformation, MB_OK);
        result := false;
    end else
        result := true;
end;

I want to see if it would be possible to do the same thing but on an XML file. I have the following XML file located at ‘C:\test_folder\test.xml’.

<Registry>
   <HKEY_LOCAL_MACHINE>
      <SOFTWARE>
         <KOFAX>
            <CONDOR Value="0" Type="integer">
               <VERSION Value="V4.10.039"/>

Anyone know how to check that version and to check if it is above 4.0? With the .Net function I simply call CheckDotNet() that then in turn calls IsDotNetDetected(‘v4\Full’, 0) I want to do the same thing with this XML file. I want the function to check if my version “V4.10.039” is greater then “4.0” by calling something like IsMySoftwareDetected(‘4.0’).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:35:13+00:00Added an answer on June 8, 2026 at 12:35 pm

    I know I’m quite late 🙂 Just wanted to complete your question since the InnoSetup code example linked in the above comment doesn’t exactly cover what you’ve asked.

    The script file:

    [Setup]
    AppName=My Program
    AppVersion=1.5
    DefaultDirName={pf}\My Program
    
    [Files]
    Source: "ProductVersion.xml"; Flags: dontcopy;
    
    [Code]
    // this function opens the XML file and returns the value of XML node
    // attribute specified by the given XPath expression
    function GetAttrValueFromXML(const AFileName, APath: string): string;
    var
      XMLNode: Variant;
      XMLDocument: Variant;  
    begin
      Result := '';
      XMLDocument := CreateOleObject('Msxml2.DOMDocument.6.0');
      try
        XMLDocument.async := False;
        XMLDocument.load(AFileName);
        if (XMLDocument.parseError.errorCode <> 0) then
          MsgBox('The XML file could not be parsed. ' + 
            XMLDocument.parseError.reason, mbError, MB_OK)
        else
        begin
          XMLDocument.setProperty('SelectionLanguage', 'XPath');
          XMLNode := XMLDocument.selectSingleNode(APath);
          Result := XMLNode.NodeValue;
        end;
      except
        MsgBox('An error occured!', mbError, MB_OK);
      end;
    end;
    
    // function that strips out all non-numeric values and returns what
    // remains as an integer, so you should keep the version string format
    function GetVersionValue(const Value: string): Integer;
    var
      S: string;
      I: Integer;
    begin
      S := Value;
      for I := Length(Value) downto 1 do
        if not ((Ord(S[I]) >= Ord('0')) and (Ord(S[I]) <= Ord('9'))) then
          Delete(S, I, 1);
      Result := StrToInt(S);
    end;
    
    procedure InitializeWizard;
    var
      S: string;
      I: Integer;
    begin
      // extract the XML file containing the version information temporarly
      ExtractTemporaryFile('ProductVersion.xml');
      // read the attribute value specified by the XPath expression
      S := GetAttrValueFromXML(ExpandConstant('{tmp}\ProductVersion.xml'),
        '//Registry/HKEY_LOCAL_MACHINE/SOFTWARE/KOFAX/CONDOR/VERSION/@Value');
      // the numeric part of the version string must be in a format X.XX.XXX
      // because the GetVersionValue function removes all non-numeric values
      // from that string and returns it as an integer value, and to compare
      // it with an integer constant they must match in the number of digits
      // following comparision means when the version is below 4.10.039 then
      if GetVersionValue(S) < 410039 then
        MsgBox('Version is below 4.10.039.', mbInformation, MB_OK)
      else
        MsgBox('Version equals or greater than 4.10.039.', mbInformation, MB_OK);
    end;
    

    The XML file (ProductVersion.xml):

    <?xml version="1.0" encoding="utf-8"?>
    <Registry>
      <HKEY_LOCAL_MACHINE>
        <SOFTWARE>
          <KOFAX>
            <CONDOR Value="0" Type="integer">
              <VERSION Value="V4.10.038"/>
            </CONDOR>
          </KOFAX>
        </SOFTWARE>
      </HKEY_LOCAL_MACHINE>
    </Registry>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have small HTTP server script that receives HTTP client requests and replies. I
I have small script that takes the value from a text input and needs
I have small script in bash, which is generating graphs via gnuplot. Everything works
I have small web app that generate PDF files as a report. I'm trying
Have small web page at www.peterbio.com/mom/test.htm Someone wrote the code with mouse over and
I have small PHP script which has $query = SELECT MAX(id) FROM `dbs`; //query
We have small class, that has a related class class Car has_one :engine, :dependent
I have small problem with simple code. This code is working properly on x86
I have small application that is uploading pictures to another website via webservice. My
I have small number of GUI attribute that i need to save in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.