• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3486
  • Last Modified:

Inno Setup questions (User Levels)

Can anyone show me how to create setup using Inno Setup for different user license, example installation option for  SIngle User License and Network License?
0
COOMET
Asked:
COOMET
  • 5
  • 4
1 Solution
 
mirtheilCommented:
Check out the CodeDlg.iss sample in the Examples directory of your InnoSetup install.  It shows how to deal with multiple license models.  
0
 
COOMETAuthor Commented:
mirtheil,

thanks for your comment.  I have seen that example but do not really know the scripting language.  Is there no a line of standard command of Inno Setup to distinguish single license and site license? At this stage I am looking for two classes of license: single user license and multiple user license.  Have you applied that script?

 
0
 
mirtheilCommented:
To be honest, in my applications, I don't rely on the installer for validating or restricting the license.  

In my opinion, the application should handle the license.  

Back to your question, how you implement a single user vs multiple user license in the installer depends on a few things.  First, how is the license implemented?  Is it a different key or different registry entry or a different installed file or something else?

I'm attaching a simpler example of the CodeDlg.iss that is geared more to a single/multiple user license.  There's a line in the code that shows where to add your logic.  If you have questions on how to implement that logic, post up how you need to apply the license.
; -- CodeDlg.iss --
;
; This script shows how to insert custom wizard pages into Setup and how to handle
; these pages. Furthermore it shows how to 'communicate' between the [Code] section
; and the regular Inno Setup sections using {code:...} constants. Finally it shows
; how to customize the settings text on the 'Ready To Install' page.
 
[Setup]
AppName=My Program
AppVerName=My Program version 1.5
DefaultDirName={pf}\My Program
DisableProgramGroupPage=yes
UninstallDisplayIcon={app}\MyProg.exe
OutputDir=userdocs:Inno Setup Examples Output
 
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
 
 
[Code]
var
  UsagePage: TInputOptionWizardPage;
  KeyPage: TInputQueryWizardPage;
  ProgressPage: TOutputProgressWizardPage;
  DataDirPage: TInputDirWizardPage;
  
procedure InitializeWizard;
begin
  { Create the pages }
  UsagePage := CreateInputOptionPage(wpWelcome,
    'Personal Information', 'How will you use My Program?',
    'Please specify how you would like to use My Program, then click Next.',
    True, False);
  UsagePage.Add('Single User mode');
  UsagePage.Add('Multiple User mode');
 
  KeyPage := CreateInputQueryPage(UsagePage.ID,
    'Personal Information', 'What''s your registration key?',
    'Please specify your registration key and click Next to continue. If you don''t ' +
    'have a valid registration key, click Back to choose a different usage mode.');
  KeyPage.Add('Registration key:', False);
 
  ProgressPage := CreateOutputProgressPage('Personal Information',
    'What''s your registration key?');
 
 
  { Set default values, using settings that were stored last time if possible }
 
  case GetPreviousData('UsageMode', '') of
    'single': UsagePage.SelectedValueIndex := 0;
    'multi': UsagePage.SelectedValueIndex := 1;
  else
    UsagePage.SelectedValueIndex := 1;
  end;
 
end;
 
procedure RegisterPreviousData(PreviousDataKey: Integer);
var
  UsageMode: String;
begin
  { Store the settings so we can restore them next time }
  case UsagePage.SelectedValueIndex of
    0: UsageMode := 'single';
    1: UsageMode := 'multi';
  end;
  SetPreviousData(PreviousDataKey, 'UsageMode', UsageMode);
end;
 
function ShouldSkipPage(PageID: Integer): Boolean;
begin
end;
 
function NextButtonClick(CurPageID: Integer): Boolean;
var
  I: Integer;
begin
  { Validate certain pages before allowing the user to proceed }
  if CurPageID = KeyPage.ID then begin
    { Just to show how 'OutputProgress' pages work.
      Always use a try..finally between the Show and Hide calls as shown below. }
    ProgressPage.SetText('Authorizing registration key...', '');
    ProgressPage.SetProgress(0, 0);
    ProgressPage.Show;
    try
      for I := 0 to 10 do begin
        ProgressPage.SetProgress(I, 10);
        Sleep(100);
      end;
    finally
      ProgressPage.Hide;
    end;
    {Here's where you'd validate the key}
    if KeyPage.Values[0] = 'inno' then
      Result := True
    else begin
      MsgBox('You must enter a valid registration key. (Hint: The key is "inno".)', mbError, MB_OK);
      Result := False;
    end;
  end else
    Result := True;
end;
 
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
  MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
  S: String;
begin
  { Fill the 'Ready Memo' with the normal settings and the custom settings }
  S := '';
  S := S + 'Personal Information:' + NewLine;
 S := S + NewLine;
  
  S := S + 'Usage Mode:' + NewLine + Space;
  case UsagePage.SelectedValueIndex of
    0: S := S + 'Single User mode';
    1: S := S + 'Multiple User mode';
  end;
  S := S + NewLine + NewLine;
  
  S := S + MemoDirInfo + NewLine;
 
  Result := S;
end;

Open in new window

0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
COOMETAuthor Commented:
thanks Mertheil.  In case of multiple users, I thought of installing the application through one license keys through the admin account so that all connected users can use the application.  Otherwise, the application would be functional only for the user account where the program is installed.  By the way, to enter the license keys, I have already a few line of code integrated in the application.  For the time being, that code register only the account holder where the application is installed.  Inno installs a copy for all users in the network.  

Thanks again.
0
 
mirtheilCommented:
> Inno installs a copy for all users in the network.
Actually, Inno only does what you tell it to do.  If you tell it to copy to a location for all users, that's what it will do.  

Why don't you post your script and tell us what behavior you are seeing and what you want it to do.
0
 
COOMETAuthor Commented:
"Actually, Inno only does what you tell it to do.  If you tell it to copy to a location for all users, that's what it will do. "

So, where can we see or order Inno to make a copy for all users or only one user. That is exactly my point.  I am not saying the shortcut on the desktop.    

"Why don't you post your script and tell us what behavior you are seeing and what you want it to do."

Below, I am attaching the default setup scrip I use very often.

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
 
#define MyAppName "My Program"
#define MyAppVerName "My Program 1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"
 
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{73DDB3FA-D843-41F1-A025-9514B8FDB377}
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
 
[Languages]
Name: english; MessagesFile: compiler:Default.isl
 
[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
 
[Files]
Source: C:\Program Files\Inno Setup 5\Examples\MyProg.exe; DestDir: {app}; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
 
[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon
 
[Run]
Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: nowait postinstall skipifsilent

Open in new window

0
 
mirtheilCommented:
>>So, where can we see or order Inno to make a copy for all users or only one user. That is exactly my point.  I am not saying the shortcut on the desktop.    

Taking this line:
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon

The desktop icon will be created in the "common" desktop which is available for All users.  If you want it on the User's desktop only, the line needs to be:
Name: {userdesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon

Now, that being said, you'll need to determine what is the best way to decide whether to install to the User Desktop or Common Desktop.  
0
 
COOMETAuthor Commented:
mirtheil, thanks a lot!
0
 
COOMETAuthor Commented:
Thanks a lot for going all along till the point I was in need of help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now