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] Récupération de valeurs


Sujet :

Outils Delphi

  1. #1
    Membre à l'essai
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2011
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Bâtiment

    Informations forums :
    Inscription : Février 2011
    Messages : 13
    Points : 12
    Points
    12
    Par défaut [Inno Setup] Récupération de valeurs
    Bonjour tout le monde,
    Je reviens vers vous avec un nouveau "problème". J'ai eu besoin pour mon Setup de créer une page personnalisée afin d'y placer 2 RadioButton par le biais d'un TNewCheckListBox ainsi que de deux textBox. Suivant le RadioButton sélectionné je rend actif ou non mes TextBox, juste la je reste classique (bien que cette partie m'a demandé un peu de temps...)

    Maintenant j'aimerais savoir comment récupérer les différentes valeurs : radioButton, et contenus des textBox, une fois la page passé afin de récupérer ces valeurs et de m'en servir comme contraintes dans mon onglet [Run].

    Voici mon [Code] :

    [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
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
     
    //Global
    var 
      PageConfigurationService: TInputQueryWizardPage;
      //PageConfigurationService: TWizardPage; 
      PageRepoProjects: TInputQueryWizardPage; 
      InformationsMsgPage: TOutputMsgWizardPage;
      CheckListBox: TNewCheckListBox;
      EditSHM, EditUDL: TNewEdit;
      TextSHM, TextUDL : TNewStaticText;
      FlagConfiguration : Integer;
     
      StringValuePage : String;
     
    //Initialize the Setup 
    function InitializeSetup(): Boolean;
    //On regarde si une version n'est pas déjà installé sur la machine au quel cas on demande à l'utilisateur de désinstaller la version déjà installé
    var
      ResultCode: Integer;
      ResultStr:string;
      begin
        Result:=True;
        begin
          If RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#SetupSetting("AppId")}_is1', 'UninstallString', ResultStr) then
          begin
            If ResultStr<>'' then
            begin
              ResultStr:=RemoveQuotes(ResultStr);
              if MsgBox('L''installation a détecté que ce programme est déjà installé. ' #13#13 'Souhaitez-vous désinstaller la version existante avant de poursuivre ?', mbConfirmation, MB_YESNO) = idYes then
              if not Exec(ResultStr, '/silent', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
              MsgBox('Erreur !!! ' #13#13 '' + SysErrorMessage(ResultCode) + '.', mbError, MB_OK);
            end;
          end;
       end;
    end;
     
    //On regarde si le Framework 4 n'est pas déjà installé sur la machine avant de l'installer
    function FrameworkIsNotInstalled: Boolean;
    begin
      Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Microsoft\.NETFramework\policy\v4.0');
    end;
     
    //On regarde si le Package C++ Redistribuable 2008 x64 n'est pas déjà installé
    function Packagex64IsNotInstalled: Boolean;
    begin
      Result := not RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Microsoft\.NETFramework\policy\v4.0');
    end;
     
    //Event Click to choice configuration
    procedure ClickEvent(Sender : TObject);
    var
     Msg : String;
     I   : Integer;
     ListBox: TNewCheckListBox;
    begin
        //ListBox := TNewCheckListBox(Sender);
        //MsgBox('', mbInformation,MB_OK);
     
        if CheckListBox.State[2] = cbChecked then
          begin
            EditSHM.Enabled := False;
            EditUDL.Enabled := False;
            //MsgBox('Ancienne', mbInformation,MB_OK);
          end
     
        if CheckListBox.State[1] = cbChecked then  
          begin
            EditSHM.Enabled := True;
            EditUDL.Enabled := True;
            //MsgBox('Nouvelle', mbInformation,MB_OK);
          end
     
     
    end;
     
    procedure ConvertConfig(xmlFileName: String);
    var
      xmlFile: String;
      xmlInhalt: TArrayOfString;
      strName: String;
      strTest: String;
      tmpConfigFile: String;
      k: Integer;
     
    begin
      xmlFile := ExpandConstant('{app}') + '\Serveur Licence\YrisSvcApp.exe.config';
      tmpConfigFile:= ExpandConstant('{app}') + '\config.tmp';
      strName :=  ExpandConstant('{app}') + '\Serveur Licence\Yris.ServeurLicence.exe';
     
      if (FileExists(xmlFile)) then begin
       //alles in string array speichern
       LoadStringsFromFile(xmlFile, xmlInhalt);
       //durch Array iterieren
       for k:=0 to GetArrayLength(xmlInhalt)-1 do
         begin
          strTest := xmlInhalt[k];
            if (Pos('key="1"', strTest) <> 0 ) then
              begin
                strTest := '  <add key="1" value="' + strName + '"/> ';
              end;
          SaveStringToFile(tmpConfigFile, strTest + #13#10,  True);
         end;
     
         DeleteFile(xmlFile); //delete the old exe.config
         RenameFile(tmpConfigFile,xmlFile);
      end;
    end;
     
    //Interface de Configuration pour le fichier SHM 
    Procedure CreateTheWizardPages;
    var
      PageConfigurationService: TWizardPage;
    begin
     
      //Create Page to select Repo for Projects
      PageRepoProjects := CreateInputQueryPage(wpSelectComponents, 'Répertoire Projets', 'Choix du répertoire des projets', '');
     
      //Create TextBox
      PageRepoProjects.Add('Répertoire Projets :', False);
      PageRepoProjects.Values[0] := '{#SetupSetting("DefaultDirName")}\Projets';   
     
      //Configuration Page to show title and description
      //PageConfigurationService := CreateInputQueryPage(wpSelectComponents, CustomMessage('TypeSHMConfigurationTitleDesc'), CustomMessage('TypeSHMConfigurationInstructionDesc'), '');
     
      PageConfigurationService := CreateCustomPage(wpSelectComponents, CustomMessage('TypeSHMConfigurationTitleDesc'), CustomMessage('TypeSHMConfigurationInstructionDesc'));
     
      //Create Configuration Choice
      CheckListBox := TNewCheckListBox.Create(PageConfigurationService);
      CheckListBox.Width := PageConfigurationService.SurfaceWidth;
      CheckListBox.Height := ScaleY(97);
      CheckListBox.BorderStyle := bsNone;
      CheckListBox.ParentColor := True;
      CheckListBox.MinItemHeight := WizardForm.TasksList.MinItemHeight;
      CheckListBox.ShowLines := False;
      CheckListBox.WantTabs := True;
      CheckListBox.Parent := PageConfigurationService.Surface;
      CheckListBox.AddGroup('Choix Configuration', '', 0, nil);
      CheckListBox.AddRadioButton('Ancienne Configuration', '', 0, True, True, nil);
      CheckListBox.AddRadioButton('Nouvelle Configuration', '', 0, False, True, nil);
      CheckListBox.OnClick := @ClickEvent;
     
      //Create Label SHM Configuration
      TextSHM := TNewStaticText.Create(PageConfigurationService);
      TextSHM.Top := CheckListBox.Top + CheckListBox.Height + ScaleY(8);
      TextSHM.Caption := 'Adresse IP du serveur de Licence :';
      TextSHM.AutoSize := True;
      TextSHM.Parent := PageConfigurationService.Surface;
     
      //Create Label UDL Configuration
      TextUDL := TNewStaticText.Create(PageConfigurationService);
      TextUDL.Top := TextSHM.Top + TextSHM.Height + ScaleY(12);
      TextUDL.Caption := 'Adresse IP du serveur UDL :';
      TextUDL.AutoSize := True;
      TextUDL.Parent := PageConfigurationService.Surface;
     
      //Create TextBox SHM Config
      EditSHM := TNewEdit.Create(PageConfigurationService);
      EditSHM.Top := CheckListBox.Top + CheckListBox.Height + ScaleY(8);
      EditSHM.Left := ScaleX(180);
      EditSHM.Width := PageConfigurationService.SurfaceWidth div 2 - ScaleX(8);
      EditSHM.Text := 'localhost';
      EditSHM.Parent := PageConfigurationService.Surface;
      EditSHM.Enabled := False;
     
      //Create TextBox UDL Config
      EditUDL := TNewEdit.Create(PageConfigurationService);
      EditUDL.Top := TextSHM.Top + TextSHM.Height + ScaleY(12);
      EditUDL.Left := ScaleX(180);
      EditUDL.Width := PageConfigurationService.SurfaceWidth div 2 - ScaleX(8);
      EditUDL.Text := 'localhost';
      EditUDL.Parent := PageConfigurationService.Surface;
      EditUDL.Enabled := False;
     
      //Create TextBox
      //PageConfigurationService.Add(CustomMessage('TypeSHMLabel'), False);
      //PageConfigurationService.Values[0] := 'localhost';
     
      //PageConfigurationService.Add(CustomMessage('TypeUDLLabel'), False);
      //PageConfigurationService.Values[1] := 'localhost';
     
      InformationsMsgPage := CreateOutputMsgPage(wpWelcome,
        'Informations Complémentaires', 'Liste des composants qui seront installés automatiquement',
        '- Microsoft .NET Framework 4.0' #13#13 +
        '- Package redistribuable Microsoft Visual C++ 2010 (x86)' #13#13 +
        '- Package redistribuable Microsoft Visual C++ 2010 (x64)' #13#13 +
        'Cliquez sur Suivant pour continuer l''installation ou sur Annuler pour sortir de l''installation.');
     
    end;
     
    // Initialisation
    procedure InitializeWizard();
    begin
       CreateTheWizardPages;
    end;
     
    //Get Udl Service Name Value
    function GetAdressIpSHM(Param: String): String;
    begin
        Result := PageConfigurationService.Values[0];
    end;
     
    function GetAdressIpUDL(Param: String): String;
    begin
        Result := PageConfigurationService.Values[1];
    end;
     
    //Get Projects Directory
    function GetProjectsDirectory(Param: String): String;
    begin
        Result := PageRepoProjects.Values[0];
    end;
     
    function ShouldSkipPage(PageID: Integer): Boolean;
    begin
      Result := ((PageFromID(PageID) = PageRepoProjects) and not IsComponentSelected('projet')) or
                ((PageFromID(PageID) = PageConfigurationService) and not IsComponentSelected('gilif'));
    end;
    Si quelqu'un à une idée ce serait génial.

    Merci d'avance,
    Cordialement

  2. #2
    Membre expérimenté
    Avatar de retwas
    Homme Profil pro
    Développeur Java/Delphi
    Inscrit en
    Mars 2010
    Messages
    698
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 32
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Développeur Java/Delphi
    Secteur : Finance

    Informations forums :
    Inscription : Mars 2010
    Messages : 698
    Points : 1 608
    Points
    1 608
    Billets dans le blog
    4
    Par défaut
    D'après ce que je peux voir le AddRadioButton doit te renvoyer un integer.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    iAncienneConfig := CheckListBox.AddRadioButton('Ancienne Configuration', '', 0, True, True, nil);
    Tu doit pouvoir ensuite tester si la valeur est cochée ou pas

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    if CheckListBox.Checked[iAncienneConfig] then
    begin
       // la checkbox ou iAncienneConfig est son numéro est coché
    end;
    Source :
    - http://www.developpez.net/forums/d75...n-p-innosetup/
    - http://www.jrsoftware.org/ishelp/ind...=scriptclasses

  3. #3
    Membre à l'essai
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Février 2011
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Bâtiment

    Informations forums :
    Inscription : Février 2011
    Messages : 13
    Points : 12
    Points
    12
    Par défaut
    Merci beaucoup retwas

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

Discussions similaires

  1. Réponses: 1
    Dernier message: 24/08/2013, 20h50
  2. Réponses: 2
    Dernier message: 16/08/2011, 09h11
  3. Réponses: 4
    Dernier message: 29/06/2010, 14h03
  4. [Inno Setup] Modifier la valeur d'une clé de registre
    Par gege2061 dans le forum Outils
    Réponses: 8
    Dernier message: 08/04/2009, 18h42
  5. Réponses: 8
    Dernier message: 17/07/2008, 13h44

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