Results 1 to 2 of 2

Thread: innosetup checking for 4.0 framework and installing if missing

  1. #1

    Thread Starter
    Lively Member swingyswongy's Avatar
    Join Date
    Jun 2010
    Location
    Bay area, CA
    Posts
    83

    innosetup checking for 4.0 framework and installing if missing

    Found a script online and tweaked it a bit. Figure others would like it to

    [CustomMessages]
    dotnetmissing=This application requires Microsoft Framework 4.0 which is not yet installed on this computer. Would you like to download it now?


    function InitializeSetup(): Boolean;
    var
    ErrorCode: Integer;
    netFrameWorkInstalled : Boolean;
    isInstalled: Cardinal;
    begin
    result := true;

    // Check for the .Net 4.0 framework
    isInstalled := 0;
    netFrameworkInstalled := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\client', 'Install', isInstalled);
    if ((netFrameworkInstalled) and (isInstalled <> 1)) then netFrameworkInstalled := false;




    if netFrameworkInstalled = false then
    begin
    if (MsgBox(ExpandConstant('{cm:dotnetmissing}'),
    mbConfirmation, MB_YESNO) = idYes) then
    begin
    ShellExec('open',
    'http://www.microsoft.com/downloads/details.aspx?familyid=9CFB2D51-5FF4-4491-B0E5-B386F32C0992&displaylang=en',
    '','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
    end;
    result := false;
    end;

    end;

  2. #2
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: innosetup checking for 4.0 framework and installing if missing

    This code checks, downloads and installs it if needed. Make sure you have the isxdl.dll also deployed. If you don't know how it works Google: "isxdl.dll Innosetup".

    [CustomMessages]
    dotnetfx40_title=.NET Framework 4.0

    en.dotnetfx40_size=48.1 MB

    [Code]
    const
    dotnetfx40_url = 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe';

    procedure dotnetfx40();
    var
    version: cardinal;
    begin
    RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Install', version);
    if version <> 1 then
    AddProduct('dotNetFx40_Full_x86_x64.exe',
    '/q /norestart',
    CustomMessage('dotnetfx40_title'),
    CustomMessage('dotnetfx40_size'),
    dotnetfx40_url);
    end;


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width