Wednesday 22 November 2017

how to build a inno setup installer run as administrator



[Setup]
PrivilegesRequired=admin


how to add Serial Key to inno setup wizard


how to add read me page to wizard


how to add agree and dis agree button to wizard page


how to create a desktop short cut

[Icons]
Name: {commondesktop}\{#MyAppName}; Filename: {app}\setup.exe; WorkingDir: {app}; IconFilename: {app}\images\setup.ico; Comment: "software";


how to create a installation log file in inno setup installer


how to build a installer which installed in program files in both 64 and 32 bit machines

[Setup]
DefaultDirName={code:GetProgramFiles}\{#MyAppName}

[code]
function GetProgramFiles(Param: string): string;
begin
  if IsWin64 then Result := ExpandConstant('{pf64}')
    else Result := ExpandConstant('{pf32}')
end;

how to build a 64 bit machine installer


tutorials about inno script studio 5.5.9


how to leave the important files when uninstalling software using innosetup


how to add icons to start menu in windows


how to add icon to the control panel programs


how to add a name below left bottom in wizard using innosetup


What are the software need for building installer


Friday 20 October 2017

How to Run a .bat file using innosetup Installer


How to create shortcut too desktop using innosetup Installer


How to install MySQL using innosetup Installer


How to delete windows service using innosetup Installer


How to stop the window service using innosetup Installer

Assuming that in windows(windows 7 or Higher versions) operating system, we have created service or by default some application created a service.

Now we want to stop that service using Innosetup, The given below code to stop the service.

[Run]
Filename: {sys}\sc.exe; Parameters: "stop service_name" ; Flags: runhidden

This code should be place in RUN section of innosetup.

Example: Considered That you have installed Mysql and its working Good. Now you want to stop Mysql service by using innosetup. Considering service_name as mysql, The given below code to stop mysql

[Run]
Filename: {sys}\sc.exe; Parameters: "stop mysql" ; Flags: runhidden.





How to check java run time environment installed or not


How to install java run time environment silently

[Files]

Source: "C:\Users\admin\Desktop\Dependies\jre-8u131-windows-i586.exe"; DestDir: "{tmp}"; DestName: "JREInstaller.exe"; AfterInstall: RunJavaInstaller();
[Code]


procedure RunJavaInstaller();
var
  StatusText: string;
  ResultCode: Integer;
  Path, Parameters: string;
begin
  Path := '{tmp}\JREInstaller.exe';
  { http://docs.oracle.com/javase/8/docs/technotes/guides/install/config.html#table_config_file_options }
  Parameters := '/s INSTALL_SILENT=Enable REBOOT=Disable SPONSORS=Disable REMOVEOUTOFDATEJRES=1';
  StatusText:= WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption:='Installing the java runtime environment. Wait a moment ...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant(Path), Parameters, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      { we inform the user we couldn't install the JRE }
      MsgBox('Java runtime environment install failed with error ' + IntToStr(ResultCode) + 
        '. Try installing it manually and try again to install MyProg.', mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
end;

How to install java Run Time Environment using inno setup Installer

[Files]

Source: "C:\Users\admin\Desktop\Dependies\jre-8u131-windows-i586.exe"; DestDir: "{tmp}"; DestName: "JREInstaller.exe";Flags: deleteafterinstall; AfterInstall: RunJavaInstaller(); Check: (NOT IsWin64) AND InstallJava();

Source: "C:\Users\admin\Desktop\Dependies\jre-8u131-windows-x64.exe"; DestDir: "{tmp}"; DestName: "JREInstaller.exe"; Flags: deleteafterinstall; AfterInstall: RunJavaInstaller(); Check: IsWin64 AND InstallJava64();
[Code]

procedure DecodeVersion(verstr: String; var verint: array of Integer);
var
  i,p: Integer; s: string;
begin
  { initialize array }
  verint := [0,0,0,0];
  i := 0;
  while ((Length(verstr) > 0) and (i < 4)) do
  begin
    p := pos ('.', verstr);
    if p > 0 then
    begin
      if p = 1 then s:= '0' else s:= Copy (verstr, 1, p - 1);
      verint[i] := StrToInt(s);
      i := i + 1;
      verstr := Copy (verstr, p+1, Length(verstr));
    end
    else
    begin
      verint[i] := StrToInt (verstr);
      verstr := '';
    end;
  end;
end;

function CompareVersion (ver1, ver2: String) : Integer;
var
  verint1, verint2: array of Integer;
  i: integer;
begin
  SetArrayLength (verint1, 4);
  DecodeVersion (ver1, verint1);

  SetArrayLength (verint2, 4);
  DecodeVersion (ver2, verint2);

  Result := 0; i := 0;
  while ((Result = 0) and ( i < 4 )) do
  begin
    if verint1[i] > verint2[i] then
      Result := 1
    else
      if verint1[i] < verint2[i] then
        Result := -1
      else
        Result := 0;
    i := i + 1;
  end;
end;

function InstallJava() : Boolean;
var
  ErrCode: Integer;
  JVer: String;
  InstallJ: Boolean;
begin
  RegQueryStringValue(
    HKLM, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JVer);
  InstallJ := true;
  if Length( JVer ) > 0 then
  begin
    if CompareVersion(JVer, '1.8') >= 0 then
    begin
      InstallJ := false;
    end;
  end;
  Result := InstallJ;
end;

function InstallJava64() : Boolean;
var
  ErrCode: Integer;
  JVer: String;
  InstallJ: Boolean;
begin
  RegQueryStringValue(
    HKLM64, 'SOFTWARE\JavaSoft\Java Runtime Environment', 'CurrentVersion', JVer);
  InstallJ := true;
  if Length( JVer ) > 0 then
  begin
    if CompareVersion(JVer, '1.8') >= 0 then
    begin
      InstallJ := false;
    end;
  end;
  Result := InstallJ;
end;

procedure RunJavaInstaller();
var
  StatusText: string;
  ResultCode: Integer;
  Path, Parameters: string;
begin
  Path := '{tmp}\JREInstaller.exe';
  { http://docs.oracle.com/javase/8/docs/technotes/guides/install/config.html#table_config_file_options }
  Parameters := '/s INSTALL_SILENT=Enable REBOOT=Disable SPONSORS=Disable REMOVEOUTOFDATEJRES=1';
  StatusText:= WizardForm.StatusLabel.Caption;
  WizardForm.StatusLabel.Caption:='Installing the java runtime environment. Wait a moment ...';
  WizardForm.ProgressGauge.Style := npbstMarquee;
  try
    if not Exec(ExpandConstant(Path), Parameters, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
    begin
      { we inform the user we couldn't install the JRE }
      MsgBox('Java runtime environment install failed with error ' + IntToStr(ResultCode) + 
        '. Try installing it manually and try again to install MyProg.', mbError, MB_OK);
    end;
  finally
    WizardForm.StatusLabel.Caption := StatusText;
    WizardForm.ProgressGauge.Style := npbstNormal;
  end;
end;

How to start a window service using innosetup Installer


How to Create window service using innosetup Installer


How to Build a Installer using innosetup