Bonjour,

voila quelques jours que j'essaie en vain d'écrire du text dans "editbox1" (qui est dans Form1.h) depuis le main.

l'erreur que j'ai c'est
Erreur 1 error C3699: '*'*: impossible d'utiliser cette indirection sur le type 'b::Form1'
et
Erreur 2 error C2059: erreur de syntaxe*: '>'
voici mon code ci dessous:

Form1.h
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
#pragma once
#include <string>
namespace b {
 
	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:
		void MarshalString ( System::String^ s, std::string& os )
		{   
			using namespace System::Runtime::InteropServices;   
			const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(s)).ToPointer();   
			os = chars;   
			Marshal::FreeHGlobal(IntPtr((void*)chars));
		}
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: ajoutez ici le code du constructeur
			//
 
		}
		void setLog(std::string text)
		{
			String^ tmp;
			MarshalString(tmp, text);
			this->textBox1->AppendText(tmp);
		}
 
		static void StaticSetLog( std::string text ) 
		{ 
			Form1* Obj = std::string<Form1*>( text ); 
			Obj->setLog(text); 
		} 
 
	protected:
		/// <summary>
		/// Nettoyage des ressources utilisées.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::TextBox^  textBox1;
 
	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->textBox1 = (gcnew System::Windows::Forms::TextBox());
			this->SuspendLayout();
			// 
			// textBox1
			// 
			this->textBox1->Location = System::Drawing::Point(12, 13);
			this->textBox1->Multiline = true;
			this->textBox1->Name = L"textBox1";
			this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical;
			this->textBox1->Size = System::Drawing::Size(260, 237);
			this->textBox1->TabIndex = 0;
			this->textBox1->Text = L"lol";
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(284, 262);
			this->Controls->Add(this->textBox1);
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->ResumeLayout(false);
			this->PerformLayout();
 
		}
#pragma endregion
	};
}
b.cpp (c'est mon main)
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
// b.cpp*: fichier projet principal.
 
#include "stdafx.h"
#include "Form1.h"
 
using namespace b;
 
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
	// Activation des effets visuels de Windows*XP avant la création de tout contrôle
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false); 
 
 
	// Créer la fenêtre principale et l'exécuter
	Application::Run(gcnew Form1());
	//Form1::textBox1->appendText("test");
	Form1::StaticSetLog("test lol");
	return 0;
}
vous noterez la tentative : //Form1::textBox1->appendText("test"); mais ça n'a pas fonctionné.

Si quelqu'un peut m'indiquer ce que je fais mal ce serait super. (en esperant sutout ne pas avoir le droit à des "ça ne respecte pas les normes ISO C++" ou en win32 c'est mieux... si je demande ça c'est qu'au final j'ai pas trop le choix...)