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

C++/CLI Discussion :

[Winform] Probl�me de tutorial Winforms en C++/CLI


Sujet :

C++/CLI

Vue hybride

Message pr�c�dent Message pr�c�dent   Message suivant Message suivant
  1. #1
    Membre confirm�
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    111
    D�tails du profil
    Informations personnelles :
    �ge : 39
    Localisation : Canada

    Informations forums :
    Inscription : Janvier 2008
    Messages : 111
    Par d�faut [Winform] Probl�me de tutorial Winforms en C++/CLI
    Bonjour,

    Je suis en train de mettre au winform en C++ et pour le coup je r�alise le parcours d'un tuto:
    http://nico-pyright.developpez.com/t...2005/winforms/

    Le tutorial est pour VS 2005 et j'utilise VS 2008, th�oriquement je devrais pas trop avoir de probl�me... Sachant que dans MSDN les infos concernant le framework 2.0 sont les m�me dans le 3.5 pour des classes qui sont contenues dans les deux framework.

    J'en suis � ce chapitre:
    5.2.Elaboration de l'application

    Lorsque je compile mon application j'ai 51 erreurs

    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
    #pragma once
     
     
    namespace NetSend 
    {
     
    	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>
    	/// Summary for Form1
    	///
    	/// WARNING: If you change the name of this class, you will need to change the
    	///          'Resource File Name' property for the managed resource compiler tool
    	///          associated with all .resx files this class depends on.  Otherwise,
    	///          the designers will not be able to interact properly with localized
    	///          resources associated with this form.
    	/// </summary>
    	public ref class Form1 : public System::Windows::Forms::Form
    	{
    		public:
    			Form1(void)
    			{
    				InitializeComponent();
    				//
    				//TODO: Add the constructor code here
    				//
    			}
     
    		protected:
    			/// <summary>
    			/// Clean up any resources being used.
    			/// </summary>
    			~Form1()
    			{
    				if (components)
    				{
    					delete components;
    				}
    			}
    		private: System::Windows::Forms::Label^  label1;
    		protected: 
    		private: System::Windows::Forms::ProgressBar^  progressBar;
     
    		private:
    			/// <summary>
    			/// Required designer variable.
    			/// </summary>
    			System::ComponentModel::Container ^components;
     
    		//variable of search computer of network
    		private: System::Collections::ArrayList ^ listOfComputer;
    		private: System::DirectoryServices::DirectoryEntries ^ entries;
     
    		#pragma region Windows Form Designer generated code
    			/// <summary>
    			/// Required method for Designer support - do not modify
    			/// the contents of this method with the code editor.
    			/// </summary>
    			void InitializeComponent(void)
    			{
    				this->label1 = (gcnew System::Windows::Forms::Label());
    				this->progressBar = (gcnew System::Windows::Forms::ProgressBar());
    				this->SuspendLayout();
    				// 
    				// label1
    				// 
    				this->label1->AutoSize = true;
    				this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 19, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
    					static_cast<System::Byte>(0)));
    				this->label1->Location = System::Drawing::Point(158, 41);
    				this->label1->Name = L"label1";
    				this->label1->Size = System::Drawing::Size(218, 30);
    				this->label1->TabIndex = 0;
    				this->label1->Text = L"WAIT PLEASE ....";
    				this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
    				// 
    				// progressBar
    				// 
    				this->progressBar->ForeColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(0)), static_cast<System::Int32>(static_cast<System::Byte>(192)), 
    					static_cast<System::Int32>(static_cast<System::Byte>(0)));
    				this->progressBar->Location = System::Drawing::Point(49, 108);
    				this->progressBar->Name = L"progressBar";
    				this->progressBar->Size = System::Drawing::Size(437, 38);
    				this->progressBar->TabIndex = 1;
    				// 
    				// Form1
    				// 
    				this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
    				this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    				this->BackColor = System::Drawing::SystemColors::ActiveCaption;
    				this->ClientSize = System::Drawing::Size(535, 185);
    				this->Controls->Add(this->progressBar);
    				this->Controls->Add(this->label1);
    				this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::None;
    				this->Name = L"Form1";
    				this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
    				this->Text = L"Form1";
    				this->ResumeLayout(false);
    				this->PerformLayout();
     
    			}
    		#pragma endregion
     
    		System::Collections::ArrayList ^ getListOfComputer ()
    		{
    			return listOfComputer;
    		}
     
    		private:
    		void ThreadProcess(void)
    		{
    			for each(System::DirectoryServices::DirectoryEntry ^ entry in entries)
    			{
    				try
    				{
    					System::Net::IPHostEntry ^ ip = System::Net::Dns::GetHostEntry(entry->Name);
    					listOfComputer->Add(entry->Name);
    				}
    				catch (System::Exception ^ ex)
    				{
    				}
    				this->progressBar->PerformStep();
    				Sleep(500);//Wait 0,5 secondes for a good display of loading.
    			}
    			this->Close();
    		}
     
    		private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) 
    		 {
    			 listOfComputer = gcnew System::Collections::ArrayList();
     
    			 System::String ^ domainName = "WORKGROUP";
    			 System::DirectoryServices::DirectoryEntry ^ domainEntry = gcnew System::DirectoryServices::DirectoryEntry(System::String::Format("WinNT://{0}", domainName));
    			 domainEntry->Children->SchemaFilter->Add("computer");
    			 entries = domainEntry->Children;
    			 int nb = 0;
    			 for each(System::DirectoryServices::DirectoryEntry ^ entry in entries)
    				 nb++;
     
    			 this->progressBar->Minimum = 0;
    			 this->progressBar->Maximum = nb;
    			 this->progressBar->Value = 0;
    			 this->progressBar->Step = 1;
     
    			 System::Threading::Thread ^ t = gcnew System::Threading::Thread(gcnew System::Threading::ThreadStart(this, &NetSendDotNet::Form1::ThreadProcess));
    			 t->Start();
    		 }
    	};
    }
    Pour commencer il me dit que
    Code : S�lectionner tout - Visualiser dans une fen�tre � part
    private: System::DirectoryServices::DirectoryEntries ^ entries;
    n'est pas correct:
    1>c:\users\christophe\documents\visual studio 2008\projects\net-send\net-send\Form1.h(56) : error C3083: 'DirectoryServices': the symbol to the left of a '::' must be a type
    1>c:\users\christophe\documents\visual studio 2008\projects\net-send\net-send\Form1.h(56) : error C2039: 'DirectoryEntries' : is not a member of 'System'
    1>c:\users\christophe\documents\visual studio 2008\projects\net-send\net-send\Form1.h(56) : error C2143: syntax error : missing ';' before '^'
    1>c:\users\christophe\documents\visual studio 2008\projects\net-send\net-send\Form1.h(56) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\users\christophe\documents\visual studio 2008\projects\net-send\net-send\Form1.h(56) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    J'ai regarder dans MSDN mais apparement la d�pendance est bonne:
    http://msdn.microsoft.com/fr-fr/libr...yservices.aspx

    Les autres erreurs sont d� je pense aux probl�me de d�claration des objets d�clar�s en attributs dans la classe.

    Je suis d�butant en C++ CLI. Je ne demande pas que l'on me donne la correction de mon code mais un d�but de piste pour corriger mes erreurs et comprendre pourquoi c'est de cette fa�on et pas d'une autre.



    Merci d'avances.

  2. #2
    Membre confirm�
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    111
    D�tails du profil
    Informations personnelles :
    �ge : 39
    Localisation : Canada

    Informations forums :
    Inscription : Janvier 2008
    Messages : 111
    Par d�faut
    Il manquait
    Code : S�lectionner tout - Visualiser dans une fen�tre � part
    #using <System.Directoryservices.dll>

+ R�pondre � la discussion
Cette discussion est r�solue.

Discussions similaires

  1. R�ponses: 0
    Dernier message: 06/04/2010, 12h40
  2. Probl�me largeur maximale WINFORM
    Par Valter dans le forum C++/CLI
    R�ponses: 8
    Dernier message: 13/10/2009, 12h13
  3. R�ponses: 8
    Dernier message: 20/01/2009, 13h11
  4. [c#, WinForms]Probl�me de connexion � base de donn�es
    Par Filippo dans le forum Windows Forms
    R�ponses: 3
    Dernier message: 21/05/2007, 09h47
  5. [C#.NET WINFORMS] Probl�me de .dll
    Par MrCyprom dans le forum Windows Forms
    R�ponses: 3
    Dernier message: 22/09/2006, 12h54

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