Thanks guys... i manage to write the program in JAVA since i did socket programming in JAVA before.... i will try to work on this first.. once its could be done as i wanted, then i will do it with C++ since i wanted the program to be in C++ :) Thanks a lot with your ideas and suggestions... It was all about socket to connect to IRC... never know it will be easy as this.... Really helped me..
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
Don't use handles on value types.
David Anton http://www.tangiblesoftwaresolutions.com Convert C++ to C#, VB, or Java Convert Java to C#, VB, or C++ Convert VB to C#, C++, Java, or Python Convert C# to VB, C++, Java, or Python
How are you trying to connect I assume you are using the mysql data provider for .net if so what is you connections string sans the username and password
a programmer traped in a thugs body
Thilek wrote:
i got a funtion that list all the files in a directory.. but the the filename is on vector but i need to list them in a list box.
Why can't you just send the listbox a LB_DIR message?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
Please read the other Q&A session I linked you to. I gave the answer to an identical question there. And it's too long to type again. Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
This is the C++/CLI (Manage C++) forum. You need to ask your question in the C++ / MFC forum.
"We make a living by what we get, we make a life by what we give." --Winston Churchill