CLR Thread

hi guys.i have problem with thread in clr i have one thread in class Form1 like:
1
2
3
4
5
6
while ( true )
{
	CPM^ _oPM    = gcnew CPM(); // the class inherit from System::Windows::Forms::Form

	_oPM->ShowWindow(this);
}

in class CPM :
1
2
3
4
5
6
7
8
9
10
11
12
private: delegate System::Void ShowWindowDlg(System::Windows::Forms::IWin32Window^);

public: System::Void ShowWindow(System::Windows::Forms::IWin32Window^ owner)
{
	if ( this->InvokeRequired )
	{
		ShowWindowDlg ^dl = gcnew ShowWindowDlg(this, &CPM::ShowWindow);
		this->Invoke(dl, gcnew array<System::Object^>{ owner });
	}
	else
		this->Show( owner );
}


But break at the run time :((( please help me when call _oPM->ShowWindow(this) programm is broke.
i want to write on Messenger and read from socket always with thread one when recieve one pm show it on new form !
Topic archived. No new replies allowed.