Hi, i am using C++/CLI 2005 and trying get properties of Form from thread.
In Form.h
#include
"thread.h"#pragma
oncenamespace
pag34 {...[ ]
private
: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {MyThreadPrue ^MyThr =
gcnew MyThreadPrue();Thread ^Thr2 =
gcnew Thread(gcnew ParameterizedThreadStart(MyThr,&MyThreadPrue::VentanaX));Thr2->Start(
this);}
In Thread.h
#ifndef
SysThread_h#define
SysThread_href
class MyThreadPrue{
public
: static void StaticThreadPrueb(); static void VentanaThr(); void VentanaX(Object ^name);};
#endif
In Thread.cpp#include
"thread.h"//using namespace System::Windows::Forms;
using
namespace System;using
namespace System::ComponentModel;using
namespace System::Collections;using
namespace System::Windows::Forms;using
namespace System::Data;using
namespace System::Drawing;using
namespace System::Threading;void
MyThreadPrue::StaticThreadPrueb(){
for (int i = 0; i < 10; i++){
MessageBox::Show(
"Thread GO!");}
}
void
MyThreadPrue::VentanaThr(){
//Form ^Form1 = gcnew Form;}
void
MyThreadPrue::VentanaX(System::Object ^name){
Form ^MiForm =
gcnew Form;MiForm ^ob = (MiForm^) name;
}
---- EOF SOURCE -----
The ob object dont create and give error, and i dont get properties of form1.
Any idea