AfxBeginThread and Thread ID

Ah hello.

I am creating a thread via AfxBeginThread, and I would like to know how I can get hold of the ID of the thread.  I can obviously assign some data structure to the thread that contains some identifier, but I would like to know the correct way to get the ID.

Any ideas ?

LVL 19
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AfxBeginThread returns CWinThread*. CWinThread::m_nThreadID is thread ID.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mrwad99Author Commented:
Thanks.  And I can rely on the fact that each thread will have a *completely unique* ID, yes ?
Every thread has unique ID among currrently running threads. Otherwise OpenThread API could open wrong thread.
I don't know whether created thread ID can be equal to ID of thread which finished some time before.
AndyAinscowFreelance programmer / ConsultantCommented:
<I don't know whether created thread ID can be equal to ID of thread which finished some time before.>

I suspect it *could* be - Why should windows need to keep track of non-existant threads?
mrwad99Author Commented:
Thanks AlexFM.  Andy: interesting, worth keeping in mind.

If anyone is interested, I have a stinker of a problem at http:Q_21802368.html on a similar slant to this one
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.