Click to See Complete Forum and Search --> : CreateThread


Sharpie
September 4th, 2010, 02:13 PM
Hello :wave:

I have some buttons on my Dialog, and for each of them I will do some jobs,
I'd like to createthread for each call (each time I press a button) :cool:

But this, I have no idea of what I am doing :ehh:, that is, Is this CreateThread used for each button necessary and for what advantages ? clearly I don't need to call it but still can make the program work :D (Pssss because my problem is simple :blush: )

So I am looking forward to your replies

I am not in a hurry because this program will finish in 2012, to be sure ;)

Thank you :wave:

VictorN
September 4th, 2010, 02:41 PM
If your project is an MFC one - use AfxBeginThread instead of CreateThread API.
If it is a Win32 application - use _beginthreadex C-runtime function to start a thread.

Sharpie
September 4th, 2010, 03:08 PM
Thanks buddy VictorN :wave:
But why and for what advantages should I do so ? :cool:

Ledidas
September 5th, 2010, 09:10 PM
VictorN means how to create a worker thread. http://www.google.com/search?q=what+is+workerthread+c%2B%2B&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

When multiple createthreads are used, you will need a message queue implemented to process each thread's messages, which complicates your problem. Normal IPC approach definitely is the way to go in your case...