Click here to Skip to main content
15,915,508 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: listbox not visible in thread Pin
Thilek25-Mar-09 9:09
Thilek25-Mar-09 9:09 
Questionhelp with C++ pragraming Pin
mimikoyan25-Mar-09 0:56
mimikoyan25-Mar-09 0:56 
QuestionForm refresh... and accept click on button while performing other task... Pin
Thilek24-Mar-09 23:31
Thilek24-Mar-09 23:31 
AnswerRe: Form refresh... and accept click on button while performing other task... Pin
N a v a n e e t h25-Mar-09 1:14
N a v a n e e t h25-Mar-09 1:14 
AnswerRe: Form refresh... and accept click on button while performing other task... Pin
erfi25-Mar-09 2:10
erfi25-Mar-09 2:10 
GeneralRe: Form refresh... and accept click on button while performing other task... Pin
Thilek25-Mar-09 3:29
Thilek25-Mar-09 3:29 
GeneralRe: Form refresh... and accept click on button while performing other task... Pin
Thilek25-Mar-09 4:04
Thilek25-Mar-09 4:04 
GeneralRe: Form refresh... and accept click on button while performing other task... [modified] Pin
erfi25-Mar-09 11:21
erfi25-Mar-09 11:21 
your code is too long and i haven't enough time to read it all. but below is the way to use a thread:

my form has two button named "buttonStart" and "buttonStop" when i press the first one my thread starts and when press the second one my thread stops. this is my code :
private: Thread^ myThread;
private: static volatile bool stop;

private: System::Void buttonStart_Click(System::Object^  sender, System::EventArgs^  e) {
			 myThread = gcnew Thread(gcnew ThreadStart( &Form1::Function ));
			 stop = false;
			 myThread->Start();
                         buttonStart->Enabled = false;
		 }
private: System::Void buttonStop_Click(System::Object^  sender, System::EventArgs^  e) {
			 stop = true;
                         buttonStart->Enabled = true;
		 }
public: static void Function()
		 {
			 MessageBox::Show("thread is now starting");
			 // for example a "do while" loop
			 do
			 {
				// do some work
			 }
			 while(stop == false);
			 MessageBox::Show("thread stoped");
		 }

you can add some extra controls to your form and see that when you press the start button your controls will be alive. my function has a infinite loop and if you run it without threads your UI hangs.

however, i suggest you to read these:
Thread Class[^]
Threading tutorial[^]
to get a clean understanding of threads. and there are many perfect articles of threading in CP[^]:
1 2 3 4 5

sometimes 0 can be 1

modified on Wednesday, March 25, 2009 5:37 PM

QuestionProblem calling C++ DLL from Excel Pin
gvanto24-Mar-09 16:12
gvanto24-Mar-09 16:12 
QuestionDebug Assertion failed error while using an mfc dll via import library in an managed console application Pin
Muhammad.Ahmad.Malik24-Mar-09 10:02
professionalMuhammad.Ahmad.Malik24-Mar-09 10:02 
QuestionRe: Debug Assertion failed error while using an mfc dll via import library in an managed console application Pin
paxal31-Mar-09 4:02
paxal31-Mar-09 4:02 
AnswerRe: Debug Assertion failed error while using an mfc dll via import library in an managed console application Pin
Muhammad.Ahmad.Malik31-Mar-09 6:55
professionalMuhammad.Ahmad.Malik31-Mar-09 6:55 
QuestionCircular Form Reference Pin
thenutz7224-Mar-09 4:28
thenutz7224-Mar-09 4:28 
AnswerRe: Circular Form Reference [modified] Pin
led mike24-Mar-09 5:20
led mike24-Mar-09 5:20 
GeneralRe: Circular Form Reference Pin
thenutz7224-Mar-09 5:47
thenutz7224-Mar-09 5:47 
GeneralRe: Circular Form Reference Pin
led mike24-Mar-09 7:07
led mike24-Mar-09 7:07 
GeneralRe: Circular Form Reference Pin
thenutz7224-Mar-09 7:10
thenutz7224-Mar-09 7:10 
GeneralRe: Circular Form Reference Pin
led mike24-Mar-09 7:12
led mike24-Mar-09 7:12 
GeneralRe: Circular Form Reference Pin
Trollslayer4-May-09 4:26
mentorTrollslayer4-May-09 4:26 
AnswerRe: Circular Form Reference Pin
erfi25-Mar-09 1:47
erfi25-Mar-09 1:47 
QuestionCannot load 64bit CLI/C++ dll in C# project when running in Vista 64bit, .NET 3.5 Pin
ndkit24-Mar-09 3:40
ndkit24-Mar-09 3:40 
AnswerRe: Cannot load 64bit CLI/C++ dll in C# project when running in Vista 64bit, .NET 3.5 Pin
ndkit24-Mar-09 18:10
ndkit24-Mar-09 18:10 
QuestionHow to write an event handler which will be continiously looking for existence of a file Pin
naveen_bij24-Mar-09 2:25
naveen_bij24-Mar-09 2:25 
AnswerRe: How to write an event handler which will be continiously looking for existence of a file Pin
Giorgi Dalakishvili24-Mar-09 2:34
mentorGiorgi Dalakishvili24-Mar-09 2:34 
QuestionCross reference between classes Pin
Sci_fie24-Mar-09 2:17
Sci_fie24-Mar-09 2:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.