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

 Delphi Discussion :

action dans listbox


Sujet :

Delphi

  1. #1
    Membre très actif
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 377
    Par défaut action dans listbox
    Bonjour,

    Je suis en train d'écrire une petite application permettant l'installation d'une successions de programmes en fonction de différents critères (autorisation, configuration, poste, version windows).

    Pour l'instant j'arrive à sélectionner les programmes à installer en fonction des critères cités ci-dessus et à les lister dans une listbox.

    j'aimerai deux mode d'installation des applications , un mode automatique et un mode manuel, pour l'instant j'essais de faire le mode manuel en exécutant l'installation en cliquant 2 fois sur la ligne concernant le programme, seulement en faisant OnDblClick=AUTOClick et apparemment ça m'exécute toute la liste de programme et pas seulement le programme que je souhaite installer.

    Comment puis-je faire pour exécuter seulement la ligne double cliqué dans ma listbox ?

    Merci

  2. #2
    Membre très actif
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 377
    Par défaut
    Quelqu'un aurai une suggestion

  3. #3
    Membre Expert

    Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Août 2002
    Messages
    1 296
    Détails du profil
    Informations personnelles :
    Âge : 44
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Août 2002
    Messages : 1 296
    Par défaut
    Quel est le code de AutoClick?

    La ligne sélectionnée peut être retrouvé grâce à la propriété ItemIndex de la ListBox.

  4. #4
    Membre très actif
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 377
    Par défaut
    voici mon 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
    unit Unit1;
     
    interface
     
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ShellAPI;
     
    type
      TForm1 = class(TForm)
        AUTO: TButton;
        Label1: TLabel;
        GroupBox1: TGroupBox;
        Portable: TRadioButton;
        Bureau: TRadioButton;
        GroupBox2: TGroupBox;
        Seven: TRadioButton;
        XP: TRadioButton;
        ListBox1: TListBox;
        ENTER: TButton;
        ComboBox1: TComboBox;
        procedure AUTOClick(Sender: TObject);
        procedure PortableClick(Sender: TObject);
        procedure SevenClick(Sender: TObject);
        procedure BureauClick(Sender: TObject);
        procedure XPClick(Sender: TObject);
        procedure ENTERClick(Sender: TObject);
        procedure ComboBox1Change(Sender: TObject);
        procedure ListBox1Click(Sender: TObject);
      private
        { Déclarations privées }
      public
     
        { Déclarations publiques }
      end;
     
    var
    Form1: TForm1;
    port,sev,bur,wxp:boolean;
    teamviewer,Dropbox,Msql,ixxat,MPLAB,FTDI,IFM,VALENCE,VENSCO,InitMysql : integer;
    manu_teamviewer,manu_Dropbox,manu_Msql,manu_ixxat,manu_MPLAB,manu_FTDI,manu_IFM,manu_VALENCE,manu_VENSCO,manu_InitMysql : integer;
    niv:integer;
     
    implementation
     
    {$R *.dfm}
     
     
     
     
    procedure TForm1.AUTOClick(Sender: TObject);
    begin
     
     
    if (Dropbox=1) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Dropbox.exe',nil,Nil,SW_SHOWDEFAULT);
    if (Msql=1) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\mysql-5.5.1-m2-win32.msi',nil,Nil,SW_SHOWDEFAULT);
    if ((ixxat=1) and sev ) then ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\VCI_2_18_4_2308.exe',nil,Nil,SW_SHOWDEFAULT);
    if (((ixxat=1) and wxp ) or (manu_ixxat=1) ) then ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\vci216+sp2.exe',nil,Nil,SW_SHOWDEFAULT);
    if (MPLAB=1) then ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\MPLAB_IDE_v8_63\setup.exe',nil,Nil,SW_SHOWDEFAULT);
    if (FTDI=1) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\CDM_2.02.04.exe',nil,Nil,SW_SHOWDEFAULT);
    if (teamviewer=1) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\TeamViewer_Setup_fr-wv.exe',nil,Nil,SW_SHOWDEFAULT);
    if (IFM=1) then ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Maintenance\setup.exe',nil,Nil,SW_SHOWDEFAULT);
    if (VALENCE=1) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Module_Diag_XP_12.9.msi',nil,Nil,SW_SHOWDEFAULT);
    if (VENSCO=1) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Vansco_USB_DLA_Driver_V1.7.exe',nil,Nil,SW_SHOWDEFAULT);
    if (InitMysql=1) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Vansco_USB_DLA_Driver_V1.7.exe',nil,Nil,SW_SHOWDEFAULT);
     
     
     
     
     
    end;
     
    procedure TForm1.PortableClick(Sender: TObject);
    begin
    port:=Portable.Checked;
    bur:=false;
     
    end;
     
    procedure TForm1.SevenClick(Sender: TObject);
    begin
     
    sev:=Seven.Checked;
    wxp:=false;
    end;
     
    procedure TForm1.BureauClick(Sender: TObject);
    begin
    bur:=Bureau.checked;
    port:=false;
     
    end;
     
    procedure TForm1.XPClick(Sender: TObject);
    begin
    wxp:=xp.checked;
    sev:=false;
    end;
     
     
    procedure TForm1.ComboBox1Change(Sender: TObject);
    begin
    niv:=StrToInt(combobox1.Text);
     
    end;
     
    procedure select();
    begin
     
     
      if ((port or bur) and (niv>=0) ) then  Dropbox:=1 else  Dropbox:=0;
      if (port and (niv>=0) ) then  Msql:=1 else  Msql:=0;
      if (port and (niv>=2) ) then  ixxat:=1 else  ixxat:=0;
      if (port and (niv>=3) ) then  MPLAB:=1 else  MPLAB:=0;
      if (port and (niv>=0) ) then  FTDI:=1 else  FTDI:=0;
      if (port and (niv>=0) ) then  teamviewer:=1 else  teamviewer:=0;
      if (port and (niv>=3) ) then  IFM:=1 else  IFM:=0;
      if (port and (niv>=3) ) then  VALENCE:=1 else VALENCE:=0;
      if (port and (niv>=3) ) then  VENSCO:=1 else  VENSCO:=0;
      if (port and (niv>=0) ) then  InitMysql:=1 else InitMysql:=0;
     
    end;
     
    procedure TForm1.ENTERClick(Sender: TObject);
    var
    MyList:TStringList;
     
    begin
    select();
    listbox1.Clear;
     
    MyList :=TStringList.Create;
     
    try
     
    if (Dropbox=1) then MyList.Add('Install Dropbox');
    if (Msql=1) then MyList.Add('Install Msql');
    if (ixxat=1) then MyList.Add('Install ixxat');
    if (MPLAB=1) then MyList.Add('Install MPLAB');
    if (FTDI=1) then MyList.Add('Install FTDI');
    if (teamviewer=1) then MyList.Add('Install teamviewer');
    if (IFM=1) then MyList.Add('Install IFM');
    if (VALENCE=1) then MyList.Add('Install VALENCE');
    if (VENSCO=1) then MyList.Add('Install VENSCO');
    if (InitMysql=1) then MyList.Add('Install InitMysql');
     
    begin
    ListBox1.Items.AddStrings(MyList);
    end;
     
    finally
    MyList.Free;
     
    end;
     
    end;
    en faite c'est dans" l'inspecteur d'objet" concernant la listbox1 , l'événement que j'ai mis OnBdlClick à AUTOclick j'avoue que je ne sais pas rélement ce que ça peu bien faire.

  5. #5
    Membre très actif
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 377
    Par défaut
    J'ai oublié la fin
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    procedure TForm1.ListBox1Click(Sender: TObject);
    begin
     
    if (listbox1.Items=('Install ixxat')) then manu_ixxat:=1;
     
    end;
     
    end.
    C'est d'ailleur à ce niveau la que je doit intervenir ?

  6. #6
    Expert éminent
    Avatar de ShaiLeTroll
    Homme Profil pro
    Développeur C++\Delphi
    Inscrit en
    Juillet 2006
    Messages
    14 165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Développeur C++\Delphi
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2006
    Messages : 14 165
    Par défaut
    Question Conne : Pourquoi ne pas utiliser InnoSetup, Install Shield si c'est pour automatiser l'installation de module dont dépend ton application ?

    Sinon, utilise une TCheckListBox, ou tu peux cocher et décocher des items
    Ton Bouton Auto lira les Checked[] pour savoir quel programme installé
    En Auto, tout est coché par défaut
    En Manuel, tu laisse le choix à l'utilisateur !

    Tu ne peux pas mettre AutoClick comme gestionnaire pour ta ListBox, le code n'est pas conçu pour gérer des items

    Tu dois gérer comme tu as commencé avec tes manu_ ...
    Mais faudrait que tu les utilises !



    Sinon, faudrait reprendre les bases de la programmation Delphi, il existe le type boolean qui sera plus pertinent que tes integer en valeur 0/1
    Cela complique la lecture du code (très mal indenté d'ailleurs)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    procedure TForm1.ListBox1Click(Sender: TObject);
    begin
     
    if (listbox1.Items=('Install ixxat')) then manu_ixxat:=1;
     
    end;
    Ce code ne compile même pas, lit donc la documentation au lieu d'inventer des syntaxes fantaisistes !

    tu dois plutôt écrire ceci

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    procedure TForm1.ListBox1DblClick(Sender: TObject);
    begin
     
      if (listbox1.Items[ListBox1.ItemIndex]= 'Install Dropbox') then 
        ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Dropbox.exe',nil,Nil,SW_SHOWDEFAULT)
      else if (listbox1.Items[ListBox1.ItemIndex]= 'Install ixxat') then
        ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\mysql-5.5.1-m2-win32.msi',nil,Nil,SW_SHOWDEFAULT)
      else if (listbox1.Items[ListBox1.ItemIndex]= 'Install Msql') then
        ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\VCI_2_18_4_2308.exe',nil,Nil,SW_SHOWDEFAULT)
      else if ...
     
    end;
    Evidemment, avec une gestion de la propriétés Objects[] (issu de la TStrings) via la propriété Items du TListBox, on pourrait avoir un code nettement plus élégant comme dans le sujet Combobox - renvoyer une valeur
    Aide via F1 - FAQ - Guide du développeur Delphi devant un problème - Pensez-y !
    Attention Troll Méchant !
    "Quand un homme a faim, mieux vaut lui apprendre à pêcher que de lui donner un poisson" Confucius
    Mieux vaut se taire et paraître idiot, Que l'ouvrir et de le confirmer !
    L'ignorance n'excuse pas la médiocrité !

    L'expérience, c'est le nom que chacun donne à ses erreurs. (Oscar Wilde)
    Il faut avoir le courage de se tromper et d'apprendre de ses erreurs

  7. #7
    Membre très actif
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 377
    Par défaut
    OK merci pour ces remarques pertinente effectivement, je début en programmation notamment sur delphi et je ne connais pas toutes les possibilités qui s'offre à moi me permettant de trouver le bon code.

    Je vais examiner un peu plus mon programme en portant mon attention sur TCheckListBox.

    Mes variables manu_... je viens juste de les déclarer je cherchais comment les utiliser dans l'état actuel des choses.

    Pour le code qui ne compile pas, je suis au courant, c'était un essai plutôt hasardeux de ma part.

  8. #8
    Membre très actif
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 377
    Par défaut
    impecable ça fonctionne correct, merci
    une dernière choses, dans l'installe automatique des programmes

    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
    procedure TForm1.AUTOClick(Sender: TObject);
    begin
     
    if ((Dropbox) or (manu_Dropbox)) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Dropbox.exe',nil,Nil,SW_SHOWDEFAULT);
    if ((Msql) or (manu_Msql) ) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\mysql-5.5.1-m2-win32.msi',nil,Nil,SW_SHOWDEFAULT);
    if (((ixxat) and sev) or ((manu_ixxat) and sev) ) then ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\VCI_2_18_4_2308.exe',nil,Nil,SW_SHOWDEFAULT);
    if (((ixxat) and wxp ) or ((manu_ixxat) and wxp) ) then ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\vci216+sp2.exe',nil,Nil,SW_SHOWDEFAULT);
    if ((MPLAB)or (manu_MPLAB)) then ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\MPLAB_IDE_v8_63\setup.exe',nil,Nil,SW_SHOWDEFAULT);
    if ((FTDI) or (manu_FTDI)) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\CDM_2.02.04.exe',nil,Nil,SW_SHOWDEFAULT);
    if (teamviewer) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\TeamViewer_Setup_fr-wv.exe',nil,Nil,SW_SHOWDEFAULT);
    if (IFM) then ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Maintenance\setup.exe',nil,Nil,SW_SHOWDEFAULT);
    if (VALENCE) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Module_Diag_XP_12.9.msi',nil,Nil,SW_SHOWDEFAULT);
    if (VENSCO) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Vansco_USB_DLA_Driver_V1.7.exe',nil,Nil,SW_SHOWDEFAULT);
    if (InitMysql) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Vansco_USB_DLA_Driver_V1.7.exe',nil,Nil,SW_SHOWDEFAULT);
    end;
    comment puis-je faire en sorte que l'installation s'exécute l'un après l'autre et non en même temps ?

  9. #9
    Modérateur
    Avatar de Rayek
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2005
    Messages
    5 236
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 236
    Par défaut
    Utilise Createprocess au lieu de shellexecute (dans la ou dans les source il y a un exemple d'exécution avec attente)

    PS: Merci de faire attention avec les balises de code
    Modérateur Delphi

    Le guide du bon forumeur :
    __________
    Rayek World : Youtube Facebook

  10. #10
    Membre très actif
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 377
    Par défaut
    Je n'arrive pas à trouver un exemple compréhensible pour mon faible niveau s'approchant de ce que je souhaite faire.

    Est-il possible d'avoir un lien

    merci

  11. #11
    Modérateur
    Avatar de Rayek
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2005
    Messages
    5 236
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 236
    Modérateur Delphi

    Le guide du bon forumeur :
    __________
    Rayek World : Youtube Facebook

  12. #12
    Membre très actif
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 377
    Par défaut
    autant pour moi, j'avais fini par le trouvé, seulement j'essai de comprendre comment l'utilisé dans mon code

    encore merci

  13. #13
    Modérateur
    Avatar de Rayek
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mars 2005
    Messages
    5 236
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 52
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 236
    Par défaut
    Si c'est pour faire un installeur, le mieux serait peut être d'utiliser InnoSetup avec IsTool qui permet d'en faire un en quelques clics
    Modérateur Delphi

    Le guide du bon forumeur :
    __________
    Rayek World : Youtube Facebook

  14. #14
    Membre très actif
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 377
    Par défaut
    merci Rayek pour l'info, Seulement InnoSetup avec IsTool sauf erreur de ma part il s'agit d'outil autre que delphi si j'ai bien compris, seulement j'ai besoin de faire quelque chose de plus qu'installer des logiciels.

    En fait, j'ai plusieurs logiciels à installer selon différents critères et ça je les fait avec un fichier sous dos en .bat pour commencer seulement certaine instruction sont pas forcement compatible sous xp ou seven et asser limiter également.

  15. #15
    Membre très actif
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 377
    Par défaut
    tout d'abord merci pour votre aide, j'ai bientôt fini mon petit programme qui marche bien et afin de le finaliser j'aurai besoin d'aide sur un dernier petit problème qui est exécution automatique de toutes les installations des programmes.

    Actuellement tout s'installe en même temps et j'aimerai savoir comment faire en sorte d'attendre l'installation avant d'attaquer la prochaine.

    Merci

    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
    begin
     
     
     
     
     
    if (Dropbox) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Dropbox.exe',nil,Nil,SW_SHOWDEFAULT);
    if (Msql ) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\mysql-5.5.1-m2-win32.msi',nil,Nil,SW_SHOWDEFAULT);
    if ((ixxat) and sev) then ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\VCI_2_18_4_2308.exe',nil,Nil,SW_SHOWDEFAULT);
    if ((ixxat) and wxp ) then ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\vci216+sp2.exe',nil,Nil,SW_SHOWDEFAULT);
    if (MPLAB) then ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\MPLAB_IDE_v8_63\setup.exe',nil,Nil,SW_SHOWDEFAULT);
    if (FTDI) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\CDM_2.02.04.exe',nil,Nil,SW_SHOWDEFAULT);
    if (teamviewer) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\TeamViewer_Setup_fr-wv.exe',nil,Nil,SW_SHOWDEFAULT);
    if (IFM) then ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Maintenance\setup.exe',nil,Nil,SW_SHOWDEFAULT);
    if (VALENCE) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Module_Diag_XP_12.9.msi',nil,Nil,SW_SHOWDEFAULT);
    if (VENSCO) then  ShellExecute(Handle,'open','\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Vansco_USB_DLA_Driver_V1.7.exe',nil,Nil,SW_SHOWDEFAULT);
    if (InitMysql) then  DeleteFile('C:\Program Files\MySQL\MySQL Server 5.5\my.ini');
                            CopyFile('\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\my.ini','C:\Program Files\MySQL\MySQL Server 5.5\my.ini',true);
     
     
    end;

  16. #16
    Expert éminent
    Avatar de ShaiLeTroll
    Homme Profil pro
    Développeur C++\Delphi
    Inscrit en
    Juillet 2006
    Messages
    14 165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Développeur C++\Delphi
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2006
    Messages : 14 165
    Par défaut
    Tu as déjà eu la réponse

    Citation Envoyé par Rayek Voir le message
    Utilise Createprocess au lieu de shellexecute
    et le lien vers la Comment lancer et contrôler une application extérieure ? qui utilise une boucle d'attente grâce à WaitForSingleObject

    si tu veux un code prêt à l'emploi, j'ai écrit CallCmd plutôt conçu pour des commandes DOS mais fonctionne aussi avec des EXE normaux !
    Aide via F1 - FAQ - Guide du développeur Delphi devant un problème - Pensez-y !
    Attention Troll Méchant !
    "Quand un homme a faim, mieux vaut lui apprendre à pêcher que de lui donner un poisson" Confucius
    Mieux vaut se taire et paraître idiot, Que l'ouvrir et de le confirmer !
    L'ignorance n'excuse pas la médiocrité !

    L'expérience, c'est le nom que chacun donne à ses erreurs. (Oscar Wilde)
    Il faut avoir le courage de se tromper et d'apprendre de ses erreurs

  17. #17
    Membre très actif
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 377
    Par défaut
    Merci, effectivement tu m'avais déjà répondu, j'ai pu voir le lien que tu m'a envoyé et je les essayé, ça fonctionne pour lancer une application seulement là ou j'ai du mal à comprendre est , à quel moment j'écris la deuxième exécution puis les dix autres suivantes ?
    est ce que je suis obligé de réécrire la boucle d'attente pour chaque installation ?

    merci

    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
    begin
      { Mise à zéro de la structure StartInfo }
      FillChar(StartInfo,SizeOf(StartInfo),#0);
      { Seule la taille est renseignée, toutes les autres options }
      { laissées à zéro prendront les valeurs par défaut }
      StartInfo.cb     := SizeOf(StartInfo);
     
      { Lancement de la ligne de commande }
      If CreateProcess(Nil, '"\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Dropbox.exe"', Nil, Nil, False,0, Nil, Nil, StartInfo,ProcessInfo) Then
      Begin
        { L'application est bien lancée, on va en attendre la fin }
        { ProcessInfo.hProcess contient le handle du process principal de l'application }
        Fin:=False;
        Repeat
          { On attend la fin de l'application }
          Case WaitForSingleObject(ProcessInfo.hProcess, 200)Of
            WAIT_OBJECT_0 :Fin:=True; { L'application est terminée, on sort }
            WAIT_TIMEOUT  :;          { elle n'est pas terminée, on continue d'attendre }
          End;
          { Mise à jour de la fenêtre pour que l'application ne paraisse pas bloquée. }
          Application.ProcessMessages;
        Until Fin;
        { C'est fini }
        ShowMessage('Terminé');
      End
      Else RaiseLastOSError;
     
    end;

  18. #18
    Expert éminent
    Avatar de ShaiLeTroll
    Homme Profil pro
    Développeur C++\Delphi
    Inscrit en
    Juillet 2006
    Messages
    14 165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Développeur C++\Delphi
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2006
    Messages : 14 165
    Par défaut
    Fait une fonction réutilisable !
    Comment veux-tu que l'on t'aide si tu n'as pas le B.A-BA requis !

    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
    procedure MaFonctionReutilisable(const ExeName: string);
    Var  StartInfo   : TStartupInfo;
         ProcessInfo : TProcessInformation;
         Fin         : Boolean;
    begin
      { Mise à zéro de la structure StartInfo }
      FillChar(StartInfo,SizeOf(StartInfo),#0);
      { Seule la taille est renseignée, toutes les autres options }
      { laissées à zéro prendront les valeurs par défaut }
      StartInfo.cb     := SizeOf(StartInfo);
     
      { Lancement de la ligne de commande }
      If CreateProcess(Nil, PChar(ExeName), Nil, Nil, False,0, Nil, Nil, StartInfo,ProcessInfo) Then
      Begin
        { L'application est bien lancée, on va en attendre la fin }
        { ProcessInfo.hProcess contient le handle du process principal de l'application }
        Fin:=False;
        Repeat
          { On attend la fin de l'application }
          Case WaitForSingleObject(ProcessInfo.hProcess, 200)Of
            WAIT_OBJECT_0 :Fin:=True; { L'application est terminée, on sort }
            WAIT_TIMEOUT  :;          { elle n'est pas terminée, on continue d'attendre }
          End;
          { Mise à jour de la fenêtre pour que l'application ne paraisse pas bloquée. }
          Application.ProcessMessages;
        Until Fin;
        { C'est fini }
      End
      Else RaiseLastOSError;
     
    end;
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    if (Dropbox) then  MaFonctionReutilisable('\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\Dropbox.exe');
    if (Msql ) then  MaFonctionReutilisable('\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\mysql-5.5.1-m2-win32.msi');
    if ((ixxat) and sev) then MaFonctionReutilisable('\\pvifiler1.pvi.local\Commun\BEE\Install_SAV\VCI_2_18_4_2308.exe');
    if ...
    Aide via F1 - FAQ - Guide du développeur Delphi devant un problème - Pensez-y !
    Attention Troll Méchant !
    "Quand un homme a faim, mieux vaut lui apprendre à pêcher que de lui donner un poisson" Confucius
    Mieux vaut se taire et paraître idiot, Que l'ouvrir et de le confirmer !
    L'ignorance n'excuse pas la médiocrité !

    L'expérience, c'est le nom que chacun donne à ses erreurs. (Oscar Wilde)
    Il faut avoir le courage de se tromper et d'apprendre de ses erreurs

  19. #19
    Membre très actif
    Homme Profil pro
    Electronicien
    Inscrit en
    Août 2008
    Messages
    377
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Electronicien
    Secteur : High Tech - Électronique et micro-électronique

    Informations forums :
    Inscription : Août 2008
    Messages : 377
    Par défaut
    merci

    "Comment veux-tu que l'on t'aide si tu n'as pas le B.A-BA requis !"

    comme je les spécifié je début sous delphi et j'essai de faire au mieux pour comprendre ce que l'on me propose.

    Mes compétence en prog ce llimite au C sous MPLAB pour microchip et un peu de VHDL pour la prog de FPGA, étant électronicien hardware à l'origine.

    Merci de votre indulgence

  20. #20
    Expert éminent
    Avatar de ShaiLeTroll
    Homme Profil pro
    Développeur C++\Delphi
    Inscrit en
    Juillet 2006
    Messages
    14 165
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Développeur C++\Delphi
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2006
    Messages : 14 165
    Par défaut
    les fonctions cela existe aussi en C !
    T'inquiète, au bureau, j'ai aussi d'anciens électroniciens hardware qui font justement du C 16bits pour microproc !

    C'est vrai qu'entre C++Builder et la POO, et la prog en C pour micro, c'est deux univers différents !
    Aide via F1 - FAQ - Guide du développeur Delphi devant un problème - Pensez-y !
    Attention Troll Méchant !
    "Quand un homme a faim, mieux vaut lui apprendre à pêcher que de lui donner un poisson" Confucius
    Mieux vaut se taire et paraître idiot, Que l'ouvrir et de le confirmer !
    L'ignorance n'excuse pas la médiocrité !

    L'expérience, c'est le nom que chacun donne à ses erreurs. (Oscar Wilde)
    Il faut avoir le courage de se tromper et d'apprendre de ses erreurs

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. Centrer un texte dans ListBox, dans OnDrawItem
    Par Sunchaser dans le forum C++Builder
    Réponses: 3
    Dernier message: 21/03/2005, 02h46
  2. [JSP]meme action dans 2 jsp
    Par zach dans le forum Servlets/JSP
    Réponses: 4
    Dernier message: 24/02/2005, 09h34
  3. Image dans listbox
    Par jabaka dans le forum C++Builder
    Réponses: 4
    Dernier message: 19/02/2005, 23h35
  4. [C#] Drop dans ListBox
    Par Freeman166 dans le forum Windows Forms
    Réponses: 8
    Dernier message: 26/01/2005, 23h46
  5. [C#] Déclencher action dans Repeater avec LinkButton
    Par globeriding dans le forum ASP.NET
    Réponses: 13
    Dernier message: 13/05/2004, 16h29

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