Il y a actuellement 388 visiteurs
Vendredi 05 Décembre 2025
accueilactualitésdossierscomparer les prixtélécharger gratuitement vos logicielsoffres d'emploiforum informatique
Connexion
Créer un compte

Besoin d'aide C++

Besoin d'aide pour configurer un serveur ? Vous souhaitez obtenir des conseils pour référencer votre site ? Un petit souci pour accéder à votre FTP ? Des soucis de programmation en PHP / ASP / HTML / XHTML / XML / XSLT / CSS / ReactJS / AngularJS / VueJS / CGI / PERL / C / MySQL / PostgreSQL ??? Nous avons peut-être la solution dans ce forum ...

Besoin d'aide C++

Message le 12 Avr 2012 18:58

Bonjours,
je me suis lancé dans le C++ depuis quelque temps
(j'utilise Microsoft visual C++ 2010 express)
mais j'ai un peu de mal avec les radio button =).
Je voudrais faire une fenetre simple avec 2 choix et un bouton Ok :

-voir les fichiers et dossier de C:\
-redémarrer

Mais je n'arrive pas a faire comprendre au logiciel comment lui dire
que si le buttton X est cocher, faire ça.
Voila le passage qui plante:
en dessous de la ligne: private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {

If radioButton1_CheckedChanged = True;
System("tree C:\")
ElseIf radioButton2_CheckedChanged = True;
System("shutdown -r -f -t 05")
EndIf;
Avatar de l'utilisateur
fredodiable
Visiteur Confirmé
Visiteur Confirmé
 
Messages: 27
Inscription: 10 Déc 2011 13:37
 


Re: Besoin d'aide C++

Message le 12 Avr 2012 20:34

Salut,

Première question, tu utilises quoi comme lib graphique ?
Avatar de l'utilisateur
H3bus
Moderateur
Moderateur
 
Messages: 12195
Inscription: 08 Avr 2008 15:13
Localisation: /home/h3bus
 

Re: Besoin d'aide C++

Message le 13 Avr 2012 11:43

Bonne question,
Comment s'avoir quel "library" j'utilise actuellement pour ce projet?
Avatar de l'utilisateur
fredodiable
Visiteur Confirmé
Visiteur Confirmé
 
Messages: 27
Inscription: 10 Déc 2011 13:37
 

Re: Besoin d'aide C++

Message le 13 Avr 2012 14:57

Ben je sais pas, il en existe plein...

Colles nous ton code entre deux balises [code][/code], et on regardera...
Avatar de l'utilisateur
H3bus
Moderateur
Moderateur
 
Messages: 12195
Inscription: 08 Avr 2008 15:13
Localisation: /home/h3bus
 

Re: Besoin d'aide C++

Message le 13 Avr 2012 15:37

Code: Tout sélectionner
#pragma once
namespace Fauxvirus {

   using namespace System;
   using namespace System::ComponentModel;
   using namespace System::Collections;
   using namespace System::Windows::Forms;
   using namespace System::Data;
   using namespace System::Drawing;

   /// <summary>
   /// Description résumée de Form1
   /// </summary>
   public ref class Form1 : public System::Windows::Forms::Form
   {
   public:
      Form1(void)
      {
         InitializeComponent();
         //
         //TODO: ajoutez ici le code du constructeur
         //
      }

   protected:
      /// <summary>
      /// Nettoyage des ressources utilisées.
      /// </summary>
      ~Form1()
      {
         if (components)
         {
            delete components;
         }
      }
   private: System::Windows::Forms::RadioButton^  radioButton1;
   protected:
   private: System::Windows::Forms::RadioButton^  radioButton2;
   private: System::Windows::Forms::Button^  button1;
   private: System::Windows::Forms::Label^  label1;
   private: System::Windows::Forms::GroupBox^  groupBox1;
   private: System::Windows::Forms::Label^  label2;

   private:
      /// <summary>
      /// Variable nécessaire au concepteur.
      /// </summary>
      System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
      /// <summary>
      /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
      /// le contenu de cette méthode avec l'éditeur de code.
      /// </summary>
      void InitializeComponent(void)
      {
         System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
         this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());
         this->radioButton2 = (gcnew System::Windows::Forms::RadioButton());
         this->button1 = (gcnew System::Windows::Forms::Button());
         this->label1 = (gcnew System::Windows::Forms::Label());
         this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
         this->label2 = (gcnew System::Windows::Forms::Label());
         this->groupBox1->SuspendLayout();
         this->SuspendLayout();
         //
         // radioButton1
         //
         this->radioButton1->AutoSize = true;
         this->radioButton1->Checked = true;
         this->radioButton1->Location = System::Drawing::Point(15, 28);
         this->radioButton1->Name = L"radioButton1";
         this->radioButton1->Size = System::Drawing::Size(84, 17);
         this->radioButton1->TabIndex = 0;
         this->radioButton1->TabStop = true;
         this->radioButton1->Text = L"Formater C:\\";
         this->radioButton1->UseVisualStyleBackColor = true;
         this->radioButton1->CheckedChanged += gcnew System::EventHandler(this, &Form1::radioButton1_CheckedChanged);
         //
         // radioButton2
         //
         this->radioButton2->AutoSize = true;
         this->radioButton2->Location = System::Drawing::Point(15, 51);
         this->radioButton2->Name = L"radioButton2";
         this->radioButton2->Size = System::Drawing::Size(80, 17);
         this->radioButton2->TabIndex = 1;
         this->radioButton2->Text = L"Redémarrer";
         this->radioButton2->UseVisualStyleBackColor = true;
         this->radioButton2->CheckedChanged += gcnew System::EventHandler(this, &Form1::radioButton2_CheckedChanged);
         //
         // button1
         //
         this->button1->Location = System::Drawing::Point(229, 131);
         this->button1->Name = L"button1";
         this->button1->Size = System::Drawing::Size(75, 23);
         this->button1->TabIndex = 2;
         this->button1->Text = L"Ok";
         this->button1->UseVisualStyleBackColor = true;
         this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
         //
         // label1
         //
         this->label1->AutoSize = true;
         this->label1->Location = System::Drawing::Point(12, 9);
         this->label1->Name = L"label1";
         this->label1->Size = System::Drawing::Size(207, 13);
         this->label1->TabIndex = 3;
         this->label1->Text = L"Une erreur est survenue lors du lancement";
         this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click);
         //
         // groupBox1
         //
         this->groupBox1->Controls->Add(this->radioButton2);
         this->groupBox1->Controls->Add(this->radioButton1);
         this->groupBox1->Location = System::Drawing::Point(15, 71);
         this->groupBox1->Name = L"groupBox1";
         this->groupBox1->Size = System::Drawing::Size(200, 83);
         this->groupBox1->TabIndex = 4;
         this->groupBox1->TabStop = false;
         this->groupBox1->Text = L"Que voulez vous faire\?";
         //
         // label2
         //
         this->label2->AutoSize = true;
         this->label2->Location = System::Drawing::Point(12, 31);
         this->label2->Name = L"label2";
         this->label2->Size = System::Drawing::Size(145, 13);
         this->label2->TabIndex = 5;
         this->label2->Text = L"de l\'application: winlogon.exe";
         this->label2->Click += gcnew System::EventHandler(this, &Form1::label2_Click);
         //
         // Form1
         //
         this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
         this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
         this->ClientSize = System::Drawing::Size(316, 175);
         this->Controls->Add(this->label2);
         this->Controls->Add(this->label1);
         this->Controls->Add(this->button1);
         this->Controls->Add(this->groupBox1);
         this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedSingle;
         this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
         this->MaximizeBox = false;
         this->MinimizeBox = false;
         this->Name = L"Form1";
         this->Text = L"Erreur";
         this->TopMost = true;
         this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
         this->groupBox1->ResumeLayout(false);
         this->groupBox1->PerformLayout();
         this->ResumeLayout(false);
         this->PerformLayout();

      }
#pragma endregion
   private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
          }
   private: System::Void radioButton1_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
          }
private: System::Void radioButton2_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
       }
private: System::Void label2_Click(System::Object^  sender, System::EventArgs^  e) {
       }
private: System::Void label1_Click(System::Object^  sender, System::EventArgs^  e) {
       }
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
          If radioButton1_CheckedChanged = True;
            System("tree C:\")
          ElseIf radioButton2_CheckedChanged = True;
            System("shutdown -r -f -t 05")
             EndIf;

       }
};
}
Avatar de l'utilisateur
fredodiable
Visiteur Confirmé
Visiteur Confirmé
 
Messages: 27
Inscription: 10 Déc 2011 13:37
 

Re: Besoin d'aide C++

Message le 14 Avr 2012 12:55

Salut,
je pense avoir résolu quelque problèmes
il ne me reste plus qu'une seule erreur : error C1021: commande de préprocesseur non valide 'If'

voila le nouveau code :

Code: Tout sélectionner
#pragma once
#If
#ElseIf
#EndIf
namespace Fauxvirus {

   using namespace System;
   using namespace System::ComponentModel;
   using namespace System::Collections;
   using namespace System::Windows::Forms;
   using namespace System::Data;
   using namespace System::Drawing;

   /// <summary>
   /// Description résumée de Form1
   /// </summary>
   public ref class Form1 : public System::Windows::Forms::Form
   {
   public:
      Form1(void)
      {
         InitializeComponent();
         //
         //TODO: ajoutez ici le code du constructeur
         //
      }

   protected:
      /// <summary>
      /// Nettoyage des ressources utilisées.
      /// </summary>
      ~Form1()
      {
         if (components)
         {
            delete components;
         }
      }
   private: System::Windows::Forms::RadioButton^  radioButton1;
   protected:
   private: System::Windows::Forms::RadioButton^  radioButton2;
   private: System::Windows::Forms::Button^  button1;
   private: System::Windows::Forms::Label^  label1;
   private: System::Windows::Forms::GroupBox^  groupBox1;
   private: System::Windows::Forms::Label^  label2;

   private:
      /// <summary>
      /// Variable nécessaire au concepteur.
      /// </summary>
      System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
      /// <summary>
      /// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
      /// le contenu de cette méthode avec l'éditeur de code.
      /// </summary>
      void InitializeComponent(void)
      {
         System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
         this->radioButton1 = (gcnew System::Windows::Forms::RadioButton());
         this->radioButton2 = (gcnew System::Windows::Forms::RadioButton());
         this->button1 = (gcnew System::Windows::Forms::Button());
         this->label1 = (gcnew System::Windows::Forms::Label());
         this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
         this->label2 = (gcnew System::Windows::Forms::Label());
         this->groupBox1->SuspendLayout();
         this->SuspendLayout();
         //
         // radioButton1
         //
         this->radioButton1->AutoSize = true;
         this->radioButton1->Checked = true;
         this->radioButton1->Location = System::Drawing::Point(15, 28);
         this->radioButton1->Name = L"radioButton1";
         this->radioButton1->Size = System::Drawing::Size(84, 17);
         this->radioButton1->TabIndex = 0;
         this->radioButton1->TabStop = true;
         this->radioButton1->Text = L"Formater C:\\";
         this->radioButton1->UseVisualStyleBackColor = true;
         this->radioButton1->CheckedChanged += gcnew System::EventHandler(this, &Form1::radioButton1_CheckedChanged);
         //
         // radioButton2
         //
         this->radioButton2->AutoSize = true;
         this->radioButton2->Location = System::Drawing::Point(15, 51);
         this->radioButton2->Name = L"radioButton2";
         this->radioButton2->Size = System::Drawing::Size(80, 17);
         this->radioButton2->TabIndex = 1;
         this->radioButton2->Text = L"Redémarrer";
         this->radioButton2->UseVisualStyleBackColor = true;
         this->radioButton2->CheckedChanged += gcnew System::EventHandler(this, &Form1::radioButton2_CheckedChanged);
         //
         // button1
         //
         this->button1->Location = System::Drawing::Point(229, 131);
         this->button1->Name = L"button1";
         this->button1->Size = System::Drawing::Size(75, 23);
         this->button1->TabIndex = 2;
         this->button1->Text = L"Ok";
         this->button1->UseVisualStyleBackColor = true;
         this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
         //
         // label1
         //
         this->label1->AutoSize = true;
         this->label1->Location = System::Drawing::Point(12, 9);
         this->label1->Name = L"label1";
         this->label1->Size = System::Drawing::Size(207, 13);
         this->label1->TabIndex = 3;
         this->label1->Text = L"Une erreur est survenue lors du lancement";
         this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click);
         //
         // groupBox1
         //
         this->groupBox1->Controls->Add(this->radioButton2);
         this->groupBox1->Controls->Add(this->radioButton1);
         this->groupBox1->Location = System::Drawing::Point(15, 71);
         this->groupBox1->Name = L"groupBox1";
         this->groupBox1->Size = System::Drawing::Size(200, 83);
         this->groupBox1->TabIndex = 4;
         this->groupBox1->TabStop = false;
         this->groupBox1->Text = L"Que voulez vous faire\?";
         //
         // label2
         //
         this->label2->AutoSize = true;
         this->label2->Location = System::Drawing::Point(12, 31);
         this->label2->Name = L"label2";
         this->label2->Size = System::Drawing::Size(145, 13);
         this->label2->TabIndex = 5;
         this->label2->Text = L"de l\'application: winlogon.exe";
         this->label2->Click += gcnew System::EventHandler(this, &Form1::label2_Click);
         //
         // Form1
         //
         this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
         this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
         this->ClientSize = System::Drawing::Size(316, 175);
         this->Controls->Add(this->label2);
         this->Controls->Add(this->label1);
         this->Controls->Add(this->button1);
         this->Controls->Add(this->groupBox1);
         this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedSingle;
         this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
         this->MaximizeBox = false;
         this->MinimizeBox = false;
         this->Name = L"Form1";
         this->Text = L"Erreur";
         this->TopMost = true;
         this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
         this->groupBox1->ResumeLayout(false);
         this->groupBox1->PerformLayout();
         this->ResumeLayout(false);
         this->PerformLayout();

      }
#pragma endregion
   private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
          }
   private: System::Void radioButton1_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
          }
private: System::Void radioButton2_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
       }
private: System::Void label2_Click(System::Object^  sender, System::EventArgs^  e) {
       }
private: System::Void label1_Click(System::Object^  sender, System::EventArgs^  e) {
       }
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
          If radioButton1_Checked = True Then
            System("tree C:\")
          ElseIf radioButton2_Checked = True Then
            System("shutdown -r -f -t 05")
             EndIf
       }
};
}
Avatar de l'utilisateur
fredodiable
Visiteur Confirmé
Visiteur Confirmé
 
Messages: 27
Inscription: 10 Déc 2011 13:37
 

Re: Besoin d'aide C++

Message le 17 Avr 2012 10:26

Salut,
j'ai résolu mon problème et pu finir mon projet du coût
merci quand même =)
Avatar de l'utilisateur
fredodiable
Visiteur Confirmé
Visiteur Confirmé
 
Messages: 27
Inscription: 10 Déc 2011 13:37
 



Sujets similaires

Message Aide pour mail camera foscam
Bonjour à tousDepuis quelques jours, je ne recois plus d'alertes de déclenchement par mail, sur mes caméras foscam.Les caméras fonctionnent bien, mais quand je fais un test d'envoi j'ai ce message"cannot get initial ok message from server"Je sais que foscam est en liquidation judiciaire de ...
Réponses: 15

Message [Réglé] Besoin de conseil pour extension sur Huawei Matebook
Bonjour à tous, je me permet de vous faire ce petit poste pour une demande précise qui va orienter mon choix, actuellement possesseur d'un Huawei Matebook XPRO de 2022 avec intel core I7 11th 16GO de ram et 1to de stockage, j'ai un problème j'arrive à saturation des 1to, pour mon entreprise j'ai bes ...
Réponses: 35

Message Besoin d'avis pour changement GPU
Bonjour. Voilà, j'ai changé ma CM, Proc et Ram il y a pas longtemps.Voici ma config actuelle:Ryzen 7 770032Go ram DDR5 5200MHzCm Asus (je me rappelle plus la ref exacte)RTX 3070Ti 8Go Kfa2Clavier Ironclad v3 by GGSouris Logitech G502 sans filCasque Logitech Pro X sans filTapis de souris Logitech Pow ...
Réponses: 1

Message Besoin de conseils pour carte graphique adaptée à la 4K
BonjourJ'ai actuellement une carte graphique AMD Radeon RX 570 Series (4 Go) avec un écran Asus Pro Art 24 pouces (1924x1200), utilisé principalement pour du traitement photo - et un peu de vidéo, généralement en HD (mais ça peut changer car mon matériel permet de filmer en 4K, ce que je n'ai pas en ...
Réponses: 3

Message Plus besoin de TLD ou DriversCloud
Bonjour,Plutôt que de tout recopier , je vous laisse lire l'article de CCM concernant cet outil génial de Microsoft : wingethttps://www.commentcamarche.net/informa ... ec-winget/C'est très simple , il suffit de savoir ouvrir une invite de commande, donc taper cmd dans sa recherche.C'est issu de comm ...
Réponses: 11

Message Besoin d'aide PC parasité par des étoiles
Bonjour à tous. Nouveau membre. Je possède un PC portable IdeaPad S145 et depuis 2 jours je ne peux pas l'éteindre en passant par l'icône en bas à gauche pour faire arrêter. Car une fenêtre s'ouvre et plein d'étoiles s'écrivent toutes seules comme si quelqu'un pilotait mon ordi. Et lorsque j'ouvre m ...
Réponses: 5

Message PC parasité par des étoiles en continu. Besoin d'aide
Bonjour à tous. Nouveau membre. J'ai posté vers 9h20 le message ci-dessous avec 13 visites mais pas de réponse. Je suis vraiment embêter avec mon problème. J'ai des recherches de travail à faire mais je suis parasité par ces étoiles qui s'affichent constamment et m'empêche d'effectuer mes recherch ...
Réponses: 1


Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 3 invités


.: Nous contacter :: Flux RSS :: Données personnelles :.