IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Outils Delphi Discussion :

[inno setup] ajouter la notion de choisir le chemin ou s'installe le programme


Sujet :

Outils Delphi

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2008
    Messages
    211
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2008
    Messages : 211
    Points : 76
    Points
    76
    Par défaut [inno setup] ajouter la notion de choisir le chemin ou s'installe le programme
    Bonjour tout le monde,

    Essayant de faire une installation personnalisée, je veux intégrer la notion ou l'utilisateur choisi le chemin où il veut mettre son programme, voici mon code qui fonctionnait avant d'ajouter cette option: (dans la section [code])
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
     
    var
    	finishedInstall:Boolean;
    	OldVersionUninstallString : string;
     
     
    //INSTALLATION
     
    // Vérification d'existant au début de l'installation
    function InitializeSetup(): Boolean;
    	begin
    		if RegKeyExists(HKEY_LOCAL_MACHINE,'SOFTWARE\PostgreSQL') = true then
    			begin
    				Msgbox('PostgreSQL semble être installé!',mbConfirmation,MB_Ok);
    				//Result:=False;
    				//ne pas installer postgresql
    				Result:=true;
    			end
    			else
    			begin
    				Msgbox('PostgreSQL ne semble pas être installé!',mbConfirmation,MB_Ok);
    				Result:=True;
    			end;
    		if RegKeyExists(HKEY_LOCAL_MACHINE,'SOFTWARE\JavaSoft\Java Development Kit') = true then
    			begin
    				Msgbox('JDK semble être installé!',mbConfirmation,MB_Ok);
    				//ne pas installer postgresql
    				//Result:=False;
    				Result:=true;
    			end
    			else
    			begin
    				Msgbox('JDK ne semble pas être installé!',mbConfirmation,MB_Ok);
    				Result:=True;
    			end;
    	end;
     
    //procédure permettant d'ajouter le about
    procedure AboutButtonOnClick(Sender: TObject);
    begin
      MsgBox('la Platforme realisée ', mbInformation, mb_Ok);
    end;
     
    //procédure pour ajouter le lien du site dans les fenêtres de l'installation
    procedure URLLabelOnClick(Sender: TObject);
    var
      ErrorCode: Integer;
    begin
      ShellExec('open', 'http://www.novadecision.com', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
    end;
     
    //procédure pour la création du bouton et du URL qui seront insérer dans toutes les fenêtre de l'instalation
    procedure CreateAboutButtonAndURLLabel(ParentForm: TSetupForm; CancelButton: TNewButton);
    var
      AboutButton: TNewButton;
      URLLabel: TNewStaticText;
    begin
      AboutButton := TNewButton.Create(ParentForm);
      AboutButton.Left := ParentForm.ClientWidth - CancelButton.Left - CancelButton.Width;
      AboutButton.Top := CancelButton.Top;
      AboutButton.Width := CancelButton.Width;
      AboutButton.Height := CancelButton.Height;
      AboutButton.Caption := '&About...';
      AboutButton.OnClick := @AboutButtonOnClick;
      AboutButton.Parent := ParentForm;
     
      URLLabel := TNewStaticText.Create(ParentForm);
      URLLabel.Caption := 'www.google.com';
      URLLabel.Cursor := crHand;
      URLLabel.OnClick := @URLLabelOnClick;
      URLLabel.Parent := ParentForm;
      { Alter Font *after* setting Parent so the correct defaults are inherited first }
      URLLabel.Font.Style := URLLabel.Font.Style + [fsUnderline];
      {URLLabel.Font.Color := clBlue;}
      URLLabel.Font.Color := clGreen;
      URLLabel.Top := AboutButton.Top + AboutButton.Height - URLLabel.Height - 2;
      URLLabel.Left := AboutButton.Left + AboutButton.Width + ScaleX(20);
    end;
     
     
    //DESINSTALLATION
     
     
    // fonction pour l'Envoie d'un message au reponsable après une désinstallation du produit
    function UninstallEzDesign(): Boolean;
    var
      Form: TSetupForm;
      FeedbackLabel0: TLabel;
      FeedbackLabel1: TLabel;
      OKButton, CancelButton: TButton;
      FeedbackMemo: TMemo;
      Feedback: String;
      Url: String;
      ErrorCode: Integer;
    begin
      Result := false;
      Form := CreateCustomForm();
      try
     
        Form.ClientWidth := ScaleX(450);
        Form.ClientHeight := ScaleY(10+23 +10+46 +10+23 +10+23+10 + 23);
     
        Form.Caption := 'désinstallation';
        Form.BorderIcons := [biSystemMenu];
        Form.BorderStyle := bsDialog;
        Form.Center;
        OKButton := TButton.Create(Form);
        OKButton.Parent := Form;
        OKButton.Width := ScaleX(75);
        OKButton.Height := ScaleY(23);
        OKButton.Left := Form.ClientWidth - ScaleX(75 + 6 + 75 + 20);
        OKButton.Top := Form.ClientHeight - ScaleY(23 + 10);
        OKButton.Caption := 'Send';
        OKButton.ModalResult := mrOk;
        OKButton.Default := true;
        CancelButton := TButton.Create(Form);
        CancelButton.Parent := Form;
        CancelButton.Width := ScaleX(75);
        CancelButton.Height := ScaleY(23);
        CancelButton.Left := Form.ClientWidth - ScaleX(75 + 20);
        CancelButton.Top := Form.ClientHeight - ScaleY(23 + 10);
        CancelButton.Caption := 'Cancel';
        CancelButton.ModalResult := mrCancel;
        CancelButton.Cancel := True;
        FeedbackMemo := TMemo.Create(Form);
        FeedbackMemo.Parent := Form;
        FeedbackMemo.Width := Form.ClientWidth - ScaleX(30 + 20);
        FeedbackMemo.Height := ScaleY(61);
        FeedbackMemo.Left := ScaleX(30);
        FeedbackMemo.Top := Form.ClientHeight - ScaleY(23 + 10 + 10) - FeedbackMemo.Height;
        FeedbackLabel0 := TLabel.Create(Form);
        FeedbackLabel0.Parent := Form;
        FeedbackLabel0.AutoSize := False;
        FeedbackLabel0.Left := ScaleX(30);
        FeedbackLabel0.Top := ScaleY(10);
        FeedbackLabel0.Width := Form.ClientWidth - ScaleX(30 + 20);
        FeedbackLabel0.Height := ScaleY(42);
        FeedbackLabel0.WordWrap := True;
        FeedbackLabel0.Caption := 'We regret you have uninstalled EzDesign. ' +
    								'To help us with future versions of EzDesign, ' +
    								'we want to know about any troubles or difficulties ' +
    								'you have experienced while using EzDesign.';
        FeedbackLabel1 := TLabel.Create(Form);
        FeedbackLabel1.Parent := Form;
        FeedbackLabel1.Left := ScaleX(30);
        FeedbackLabel1.Top := ScaleY(10+42+10);
        FeedbackLabel1.AutoSize := True;
        FeedbackLabel1.Height := ScaleY(21);
        FeedbackLabel1.Caption := 'Please let us know...';
        FeedbackLabel1.FocusControl := FeedbackMemo;
        Form.ActiveControl := FeedbackMemo;
        if Form.ShowModal() = mrOk then
        begin
    		Feedback := Trim(FeedbackMemo.Lines.Text);
    		if Feedback <> '' then
    		begin
    			StringChange(Feedback, '&amp;', '%26');
    			StringChange(Feedback, #13#10, '%0A');
    			StringChange(Feedback, #13, '%0A');
    			StringChange(Feedback, #10, '%0D');
    			Url := 'mailto:user@gmail.com?Subject=' +
    					'EzDesign%20Uninstall&amp;' + 'Body=' + Feedback;
    			ShellExec('open', Url, '', '', SW_SHOW, ewNoWait, ErrorCode);
    		end;
        end;
    	finally
        Form.Free();
    	end;
    end;
     
    //Appeler les fonction de la UninstallEzDesign durant la désinstallation
    procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
    var
      WindowNumber: HWND;
    var
      RegDir: String;
    begin
      if CurUninstallStep = usUninstall then
      begin
    	UninstallEzDesign();
      end;
    end;
    ce code permettait d'avoir une fenêtre d'installation avec des touches personnele tel le nom du fourniseur, un bouton 'about' pour plus d'info sur le produit.

    Une fois que j'ajoute ce code qui normalement devait ajouter dans l'installation une fenêtre permettant à l'utilisateur de choisir son répertoire j'obtient après compilation l'erreur suivant "Runtime Error (at 29:128): Could not call proc"
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
     
    procedure CreateTheWizardPages;
    var
      Page: TWizardPage;
      Edit: TNewEdit;
      FolderTreeView: TFolderTreeView;
    begin
      { TFolderTreeView }
     
      Page := CreateCustomPage(Page.ID, 'Custom wizard page controls', 'FolderTreeView');
     
      FolderTreeView := TFolderTreeView.Create(Page);
      FolderTreeView.Width := Page.SurfaceWidth;
      FolderTreeView.Height := Page.SurfaceHeight;
      FolderTreeView.Parent := Page.Surface;
      FolderTreeView.Directory := ExpandConstant('{src}');
    end;
     
     
    //Ajouter les Wizards dans les fenêtre (About and URL)
    procedure InitializeWizard();
    var
    	BackgroundBitmapImage: TBitmapImage;
    	BackgroundBitmapText: TNewStaticText;
     
        Name1: string;
    	PlayButton, PauseButton, StopButton: TButton;
     
    begin
    	CreateTheWizardPages;
     
      { Custom controls }
     
      CreateAboutButtonAndURLLabel(WizardForm, WizardForm.CancelButton);
     
      BackgroundBitmapImage := TBitmapImage.Create(MainForm);
      BackgroundBitmapImage.Left := 10;
      BackgroundBitmapImage.Top := 90;
      BackgroundBitmapImage.AutoSize := True;
      BackgroundBitmapImage.Bitmap := WizardForm.WizardBitmapImage.Bitmap;
      BackgroundBitmapImage.Parent := MainForm;
     
      BackgroundBitmapText := TNewStaticText.Create(MainForm);
      BackgroundBitmapText.Left := BackgroundBitmapImage.Left;
      BackgroundBitmapText.Top := BackgroundBitmapImage.Top + BackgroundBitmapImage.Height + ScaleY(8);
      BackgroundBitmapText.Caption := 'khcvihkj';
      BackgroundBitmapText.Parent := MainForm;
    end;
    Est ce que quelqu'un serait d'où vient l'erreur, sinon pour quoi Le choix du répertoire se fait automatiquement dans la génération du script sous inno setup mais une fois qu'on personnalise l'installation on l'a plus?

    Merci pour vos suggestions

    Cordialement

  2. #2
    Expert éminent sénior

    Avatar de sjrd
    Homme Profil pro
    Directeur de projet
    Inscrit en
    Juin 2004
    Messages
    4 517
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : Suisse

    Informations professionnelles :
    Activité : Directeur de projet
    Secteur : Enseignement

    Informations forums :
    Inscription : Juin 2004
    Messages : 4 517
    Points : 10 154
    Points
    10 154
    Par défaut
    Citation Envoyé par ririrourou Voir le message
    je veux intégrer la notion ou l'utilisateur choisi le chemin où il veut mettre son programme

    Inno Setup fait ça de base de chez base ! Et même par défaut ! Je ne comprends vraiment pas où tu veux en venir.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Inno Setup] ajouter l'installation de java
    Par jeanGuignol dans le forum Outils
    Réponses: 13
    Dernier message: 26/10/2009, 23h36
  2. Réponses: 2
    Dernier message: 10/06/2009, 16h44
  3. [Inno Setup] Ajout d'un label sur une page
    Par defluc dans le forum Outils
    Réponses: 3
    Dernier message: 19/01/2009, 13h58
  4. [Inno Setup] ajouter *.reg au registre
    Par maxbat dans le forum Installation, Déploiement et Sécurité
    Réponses: 4
    Dernier message: 23/06/2007, 15h57
  5. [Inno Setup] ajouter une page avec des checkbox
    Par cotede2 dans le forum Installation, Déploiement et Sécurité
    Réponses: 4
    Dernier message: 28/05/2007, 23h01

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo