Il y a actuellement 152 visiteurs
Vendredi 10 Mai 2024
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 suite à une analyse FRST contre un virus vbc.exe
Bonjour tout le monde, J'ai récemment constaté que j'étais infecté par un virus lié à vbc.exe, ce qui entraîne une utilisation du CPU allant jusqu'à 30% voire 40%. J'ai donc effectué mes analyses FRST et voici les rapports obtenus : - FRST.txt: https://pjjoint.malekal.com/files.php?id=FRST_20240315_ ...
Réponses: 3

Message : besoin d'aide pour un pc portable à 500 euros
Bonjour à tous, J'ai besoin d'un sacré coup de main et de vos compétences. Voilà, j'ai un ami de mon fils avec ses frères et s?urs. Ils vont casser leur tirelire pour acheter un PC portable à leur s?ur pour son anniversaire . Elle va avoir 17 ans car leurs parents ne peuvent pas se le permettre . ...
Réponses: 3

Message Aide pc portable
Bonjour,Je souhaiterai faire plaisir à ma femme et lui acheter un pc portable qui ferait tourner world of warcraft en haute qualité (élevé ou ultra sans lag). J?ai fait un peu le tour sur le forum pour pas faire de doublon mais je n?ai rien trouvé. J?ai un petit budget max 700 euros avec un écran au ...
Réponses: 5

Message [réglé] aide pour achat imprimante compatible chromebook
Bonjour à tous, j'ai besoin d'acheter une imprimante laser n/b et couleur compatible Chromebook (un acer)Quelqu'un pourrait-il m'aider car je ne trouve rien par les moteurs de recherche. Les réponses données ne sont pas compatibles.Un grand merci pour votre aide
Réponses: 6

Message Aide achat PC Portable
Bonjour Je viens sur le forum car j'envisage de changer de PC Portable et j'ai besoin d'aide !! Mon PC actuel : PC Portable ASUS R415UA-EB035T - 14" FHD sur lequel je suis passé de 8Go de mémoire vive à 16Go de mémoire vive Mon budget : 800 euros max Mon utilisation : internet et Word et lectur ...
Réponses: 9

Message [Réglé] Aide nettoyage pc
Bonjour, mon pc rame et j'aimerais avoir votre aide pour déjà vérifier si il n'est pas infecté
Réponses: 12

Message [Réglé] Aide pour analyse fichier FRST
Bonsoir,J'ai une fenêtre Powershell.exe qui s'ouvre et se ferme quelques minutes après le démarrage et ca n'était pas le cas avant.Mise à jour windows et mise à jour Nvidia récente.J'ai effectué une analyse et j'ai obtenu les fichiers texte suivants.Est ce que quelqu'un peut m'aider et me dire de qu ...
Réponses: 7


Qui est en ligne

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


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