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 :

Capte Info Control


Sujet :

Delphi

  1. #1
    Nouveau membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2015
    Messages
    34
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 27
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mars 2015
    Messages : 34
    Points : 32
    Points
    32
    Par défaut Capte Info Control
    Bonjour, pour un projet de terminal STI2D j'ai pris sur un topic de ce site "http://delphi.developpez.com/faq/?page=Gestion-execution#executerapplication" une partie de code.
    Mais après l'avoir mis a ma sauce, je tombe sur une tuile... Quand je veux compiler, il me dit "identificateur non déclaré : 'CapteInfoControl'".
    Après avoir chercher sur internet, aucune réponse ... Je fais donc appelle à cette communauté (:

    Merci d'avance !

  2. #2
    Rédacteur/Modérateur

    Avatar de SergioMaster
    Homme Profil pro
    Développeur informatique retraité
    Inscrit en
    Janvier 2007
    Messages
    15 043
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 67
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur informatique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2007
    Messages : 15 043
    Points : 40 957
    Points
    40 957
    Billets dans le blog
    62
    Par défaut
    Bonjour et Bienvenue sur ce forum,

    CapteInfoControl est le nom d'une procedure de TForm1 qu'il faut bien sur déclarer !
    Quelques conseils d'utilisation du forum :
    - il aurait été bon d'indiquer le lien exact et ce en utilisant le bouton servant à créer des liens, cela m'aurait (nous aurait) facilité la tâche

    - il aurait été bon de fournir votre code
    MVP Embarcadero
    Delphi installés : D3,D7,D2010,XE4,XE7,D10 (Rio, Sidney), D11 (Alexandria), D12 (Athènes)
    SGBD : Firebird 2.5, 3, SQLite
    générateurs États : FastReport, Rave, QuickReport
    OS : Window Vista, Windows 10, Windows 11, Ubuntu, Androïd

  3. #3
    Membre chevronné

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

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

    Informations forums :
    Inscription : Août 2002
    Messages : 1 288
    Points : 1 936
    Points
    1 936
    Par défaut
    Montre nous ton code, tu as sûrement dû le déclarer dans la partie implementation, mais pas dans la partie interface.
    Delphi 7/XE2/XE3
    C#
    Oracle 9i à 12c
    SQL Server 2008 à 2014

  4. #4
    Nouveau membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2015
    Messages
    34
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 27
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mars 2015
    Messages : 34
    Points : 32
    Points
    32
    Par défaut
    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
    unit Interface1;
     
    interface
     
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ComCtrls, ExtCtrls, ShellApi, Grids, MMSystem, Gauges;
     
    type
      TForm1 = class(TForm)
        BPSTART: TButton;
        BPRESTART: TButton;
        BPSTOP: TButton;
        ProgressBar1: TProgressBar;
        Label1: TLabel;
        BPIMPRIME: TButton;
        BP5: TButton;
        Button1: TButton;
        Timer1: TTimer;
        Choisir: TComboBox;
        PrintDialog1: TPrintDialog;
        OpenDialog1: TOpenDialog;
        Button2: TButton;
        BP6: TButton;
        Button5: TButton;
        Button3: TButton;
        Button4: TButton;
        Label2: TLabel;
        procedure Button1Click(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
        procedure BP5Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure BPIMPRIMEClick(Sender: TObject);
        procedure BP6Click(Sender: TObject);
        procedure Button5Click(Sender: TObject);
        procedure BPSTARTClick(Sender: TObject);
        procedure BPSTOPClick(Sender: TObject);
        procedure Button3Click(Sender: TObject);
        procedure Button4Click(Sender: TObject);
     
     
      private
        { Déclarations privées }
      public
        { Déclarations publiques }
      end;
     
    var
      Form1: TForm1;
      x : Integer ;
      Edit1 : integer ;
      OnKeyDown : Boolean ;
     
     
     
     
     
     
    implementation
     
    uses Unit2, Unit3;
     
    {$R *.dfm}
     
     
     
     
     
    procedure TForm1.Button1Click(Sender: TObject);
    begin
       showmessage('Interface crée par T.BENE pour un projet de QCM');
    end;
     
     
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
       progressBar1.Position := ProgressBar1.Position+1 ;
     
     
       //if ShellExecute(0,'OPEN','projet0.pps', Nil, Nil, SW_SHOW)
     
     
       //MMRESULT timeSetEvent(3000 uDelay, 2 uResolution, 0 lpTimeProc, DWORD dwUser, TIME_PERIODIC fuEvent);
     
       //if OnKeyDown
       //then ProgressBar1.Position+1
     
       //if ProgressBar1.Position= 10
       //then close ;
       //listBox1.Style := ListBox1.Style+1 ;
       //do
       //ProgressBar1.Position+1 for timer1 +10 ;
    end;
     
    procedure TForm1.BP5Click(Sender: TObject);
    begin
      ProgressBar1.Position := ProgressBar1.Position+1
    end;
     
     
    procedure TForm1.Button2Click(Sender: TObject);
    begin
       Close ;
    end;
     
    procedure TForm1.FormCreate(Sender: TObject);
    begin
        timer1.Enabled := False ;
        Form1.Position := poScreenCenter;
         //Form1.WindowState := wsMaximized;
         //Form1.WindowState := wsNormal;
         //Form1.WindowState := wsMaximized ;
     
    end;
     
     
    procedure TForm1.BPIMPRIMEClick(Sender: TObject);
    begin
      //Form1.Print;
    end;
     
    procedure TForm1.BP6Click(Sender: TObject);
    begin
        Form2.Show;
        Form2.WindowState := wsNormal;
    end;
     
    procedure TForm1.Button5Click(Sender: TObject);
    //begin
            //ShellExecute(0,'OPEN','TestComVox.exe', Nil, Nil, SW_SHOW);
            //ShellExecute(0,'OPEN','gayyyy.pps', Nil, Nil, SW_SHOW);
            //ShellExecute(0,'OPEN','projet0.pps', Nil, Nil, SW_SHOW)
     
    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, '"Station_meteo.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;
     
     
    procedure TForm1.BPSTARTClick(Sender: TObject);
    begin
         //ListBox1.Items.Add('gay');
       timer1.Enabled := true ;
       //ShellExecute(0,'OPEN','gayyyy.pptx', Nil, Nil, SW_SHOW);
    end;
     
    procedure TForm1.BPSTOPClick(Sender: TObject);
    begin
        timer1.Enabled := false  ;
    end;
     
    procedure TForm1.Button3Click(Sender: TObject);
    begin
       Form3.ShowModal;
        //Form3 := TForm3.Create(Self);
       //Form3.Show();
       //PrintDialog1.Execute;
       //PrinterSetupDialog1.Execute;
    end;
     
    procedure TForm1.Button4Click(Sender: TObject);
    begin
       IF ShellExecute(Handle,'print','12.PDF',nil,nil,SW_HIDE) <=32 THEN ShowMessage(SysErrorMessage(GetLastError));
    end;
     
    end.
    voilà mon code.
    Mais comment définir la fonction, même quand je l'appelle dans les Variables, ou dans uses ça ne fonctionne pas.

  5. #5
    Membre chevronné

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

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

    Informations forums :
    Inscription : Août 2002
    Messages : 1 288
    Points : 1 936
    Points
    1 936
    Par défaut
    Premièrement, nommes tous tes composants, pour plus de lisibilité et de maintenabilité.

    Ensuite pour la déclaration:
    -dans la partie interface de ton objet, déclares ta fonction:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    type 
    TForm1 = class(TForm)
    ...
    private
    ...procedure CapteInfoControl;
    ...
    end;
    En ensuite, dans la partie implementation
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
     
    procedure TForm1.CapteInfoControl;
    begin
    ... ton code
    end;
    Delphi 7/XE2/XE3
    C#
    Oracle 9i à 12c
    SQL Server 2008 à 2014

Discussions similaires

  1. Infos sur une liste controle
    Par Portugal86 dans le forum MFC
    Réponses: 1
    Dernier message: 09/03/2007, 19h54
  2. Ajax Control Toolkit, info ou intox?
    Par gniouf2k6 dans le forum ASP.NET
    Réponses: 3
    Dernier message: 15/02/2007, 08h59
  3. pb: controle des infos sur cases à cocher: cas particulier
    Par slyfer dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 07/02/2007, 21h17
  4. Réponses: 1
    Dernier message: 20/01/2007, 11h47
  5. Réponses: 2
    Dernier message: 09/05/2006, 10h14

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