Link to home
Start Free TrialLog in
Avatar of mike_marquet
mike_marquet

asked on

Converting a thread handle to a thread ID and vice versa !

How can I get the thread ID corresponding to a thread handle ?

How can I get the thread handle corresponding to a thread ID ?

A function exist 'void GetThreadID(HANDLE)', but works only under .NET

What's about VC6.0 !
ASKER CERTIFIED SOLUTION
Avatar of JMoon5FTM
JMoon5FTM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mike_marquet
mike_marquet

ASKER

I will try to use EnumThreadWindows because I need it under Windows NT4
What's about a thread that is not associated with a window (create using CreateThread function) !
If you're desperate, I suppose you can inject code into the thread to force it to create a window (provided you have the permissions to do this).  There ought to be a better way, and I'll look around, but I really don't think there is.
mike_marquet:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
If mike_marquet had to retrieve the id of a thread that didn't create any windows, he would have had to inject code and do other such nasty things that I didn't describe, and thus I don't suppose I'd quite deserve an A.  However, I do believe that I've answered all of his questions about converting between thread ids and handles.  If this is not the case, he should post what issues he still has.  Otherwise, I think my comment should be accepted as the answer.