Theodoros Bebekis wrote:
> O/H mauro russo Ýãñáøå:
>> Dear all,
>>
>> Is there a way to get the TThread object starting from the ThreadId?
>
> Not sure what you mean by that...

A Windows thread is identified by its ID. When you create a thread with
CreateThread, you've given an ID and a handle to the new thread.

The Delphi TThread class is a wrapper for a Windows thread. If you have a
TThread object, you can read its ThreadID property to get the ID of the
underlying Windows thread. But if all you have is an ID, there's no way to
find out which TThread instance is wrapping it, if there's any at all.

> Why not to store a reference of your thread object in a variable?
>
> anyway, go to the "Processes and Threads" topic of the SDK online help.
> There you'll find functions like GetThreadID(), OpenThread() etc.

Those all operate at the OS level, not at the Delphi level. They don't
know anything about TThread.

-- 
Rob


Reply via email to