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
|
#pragma once
namespace Simulateur_GPS_M2000D {
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
///
/// AVERTISSEMENT*: si vous modifiez le nom de cette classe, vous devrez modifier la
/// propriété 'Nom du fichier de ressources' de l'outil de compilation de ressource managée
/// pour tous les fichiers .resx dont dépend cette classe. Dans le cas contraire,
/// les concepteurs ne pourront pas interagir correctement avec les ressources
/// localisées associées à ce formulaire.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public: UdpClient^ UDP;
public: ThreadStart^ Start_Reception_UDP;
public: Thread^ Thread_Reception_UDP;
public: Form1^ w;
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::Label^ label1;
private: System::Windows::Forms::Label^ label2;
protected:
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)
{
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(204, 100);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(35, 13);
this->label1->TabIndex = 0;
this->label1->Text = L"label1";
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(178, 190);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(35, 13);
this->label2->TabIndex = 1;
this->label2->Text = L"label2";
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 266);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
public: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
w=gcnew Form1;
UDP=gcnew UdpClient(5500);
Start_Reception_UDP=gcnew ThreadStart(w,&Form1::Reception_UDP);
Thread_Reception_UDP=gcnew Thread(Start_Reception_UDP);
Thread_Reception_UDP->Start();
for(int i=0;i<100;i++)
label1->Text=Convert::ToString(i);
}
public: void Reception_UDP()
{
IPEndPoint^ RemoteIpEndPoint=gcnew IPEndPoint(IPAddress::Any,0);
array<Byte>^ receiveBytes= UDP->Receive(RemoteIpEndPoint);
String^ returnData=Encoding::ASCII->GetString(receiveBytes);
}
};
} |
Partager