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

Langage Delphi Discussion :

Convertir string en Array of Char et point de restauration


Sujet :

Langage Delphi

  1. #21
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juin 2004
    Messages
    47
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2004
    Messages : 47
    Points : 39
    Points
    39
    Par défaut
    oui c'est bien sur InfoPointRestauration.szDescription := RestoreName;
    qu'est l'erreur.

    Je vais tester ta solution, j'espère que cette fois c'est la bonne

    Encore merci

  2. #22
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juin 2004
    Messages
    47
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2004
    Messages : 47
    Points : 39
    Points
    39
    Par défaut
    désolé marche pas plus !

    Voici donc le code complet pour celui qui parviendra au sommet de mon estime :-)

    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
     
    procedure TForm1.mnuCreateSysRestoreClick(Sender: TObject);
    // Crée et annule un point de restauration en cas d'erreur
     
     procedure Affiche(Texte:String);
      begin
         StatusBar1.Panels[2].text := Texte+' Données du point de restauration :' + crlf +
         'Numéro de séquence : ' + Format('%d', [SMgrStatus.llSequenceNumber]) + crlf +
         'Statut: ' + Format('%u', [SMgrStatus.nStatus])
      end;
     
    begin
       // Initialise l'enregistrement
      InfoPointRestauration.dwEventType := BEGIN_SYSTEM_CHANGE;
      InfoPointRestauration.dwRestorePtType := APPLICATION_INSTALL;
      InfoPointRestauration.llSequenceNumber := 0;
     
      {C'est ici ! Réussir : InfoPointRestauration.szDescription := RestoreName;
      RestoreName := InputBox('Point de restauration', 'Entrez un nom', 'Nouveau point de restauration'); }
      InfoPointRestauration.szDescription := 'Nouveau point de restauration';
     
      if (SRSetRestorePointA(@InfoPointRestauration, @SMgrStatus)) then
       begin
         Affiche('Configure le point de restauration.');
     
         // Configuration pour annuler le point de restauration précédent.
         InfoPointRestauration.dwEventType := END_SYSTEM_CHANGE;
     
         {Pour annuler le point de restauration actuel:}
         //InfoPointRestauration.dwRestorePtType  := CANCELLED_OPERATION;
     
         // Termine les modifications systéme en passant le numéro de séquence
         // recu lors du premier appel à l'API SRSetRestorePoint.
         InfoPointRestauration.llSequenceNumber := SMgrStatus.llSequenceNumber;
     
         // Notifie le système que les modifications sont terminée et
         // que c'est la  fin du point de restauration.
         if not SRSetRestorePointA(@InfoPointRestauration, @SMgrStatus) then
         begin
            Affiche('Ne peut pas positionner la fin du point de restauration.');
            Exit;
         end
       end;
    end;
    Bon courage !

  3. #23
    bjl
    bjl est déconnecté
    Membre averti Avatar de bjl
    Profil pro
    Inscrit en
    Décembre 2002
    Messages
    263
    Détails du profil
    Informations personnelles :
    Localisation : Brésil

    Informations forums :
    Inscription : Décembre 2002
    Messages : 263
    Points : 338
    Points
    338
    Par défaut
    hello,

    le code suivant fonctionne chez moi. si il ne marche pas chez toi, on regardera la manière dont tu déclares InfoPointRestauration.


    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
    procedure TForm1.Button1Click(Sender: TObject);
    var
      InfoPointRestauration: RESTOREPOINTINFO;
      RestoreName : String;
    begin
       // Initialise l'enregistrement
      InfoPointRestauration.dwEventType := BEGIN_SYSTEM_CHANGE;
      InfoPointRestauration.dwRestorePtType := APPLICATION_INSTALL;
      InfoPointRestauration.llSequenceNumber := 0;
     
      RestoreName := InputBox('Point de restauration', 'Entrez un nom', 'Nouveau point de restauration');
      If Length(restoreName) > Length(InfoPointRestauration.szDescription) then // empêche la recopie d'un string supérieur à MAX_DESC
        SetLength(restoreName, Length(InfoPointRestauration.szDescription));
      FillChar(InfoPointRestauration.szDescription[0], Length(InfoPointRestauration.szDescription), 0); // Initialise les valeurs du tableau
      move(RestoreName[1], InfoPointRestauration.szDescription[0], length(restoreName)); // recopie restorename dans le tableau
    end;

Discussions similaires

  1. convertir string en char array
    Par cecile38 dans le forum C++
    Réponses: 2
    Dernier message: 22/05/2012, 13h51
  2. Spliter un string en array of char ?
    Par MaTHieU_ dans le forum Delphi
    Réponses: 5
    Dernier message: 18/03/2007, 22h11
  3. Copy String to array of char
    Par Ardely dans le forum Delphi
    Réponses: 11
    Dernier message: 11/02/2007, 00h24
  4. Champ String et Constante Array of Char ?
    Par BXDSPORT dans le forum Delphi
    Réponses: 4
    Dernier message: 24/08/2006, 12h35
  5. Convertir String en Char: comment?
    Par nmathon dans le forum Langage
    Réponses: 2
    Dernier message: 22/08/2005, 20h58

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