🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1226

Re: Handle from ThreadId, CreateToolhelp32Snapshot, THREADENTRY32

#1226
From: Remy Lebeau (TeamB)
Date: Thu, 11 Oct 2007 17:34
22 lines
1822 bytes
"Richard Kavanagh" <dd.foldhill[at]googlemail.com> wrote in message
news:470e1044$1@newsgroups.borland.com...

> However the 'th32ThreadID' field of the THREADENTRY32
> structure is not always the same 32 bit value as the thread's handle

It is not supposed to be.  A thread ID is not the same thing as a thread
handle.  The ID is just a unique number that is assigned to identify the
thread.  The handle points to the actual thread object itself.

> Is there a way to retrieve the handle from this structure?

On Windows 2000 and later, you can use OpenThread().  On older versions,
there is no direct way to get a thread handle from a thread ID and vice
versa.  Have a look at the following posting for more information:


http://groups.google.com/group/borland.public.delphi.winapi/msg/ed9350f2ffdd3432


Gambit
Technical Details
Message-ID: <470e5eca$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <470e1044$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,41b94c13173582a2
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <470e1044$1@newsgroups.borland.com>
Subject: Re: Handle from ThreadId, CreateToolhelp32Snapshot, THREADENTRY32
Date: Thu, 11 Oct 2007 10:34:16 -0700
Lines: 24
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 75.83.29.61
Message-ID: <470e5eca$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1192124106 75.83.29.61 (11 Oct 2007 10:35:06 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail