Thread ID

Posted on 2003-03-25
Medium Priority
Last Modified: 2010-04-17
How can i get the ThreadID of a running process, I only know how to get it into the Process_Information struct using CreateProcess, But thats not very helpful if the process is already running.

Question by:-TM-
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8206632
GetCurrentThreadId() gets the ID of the current thread, so you could make a thread-method for getting the ID.

is only supported in Windows Server 2003.

LVL 30

Expert Comment

by:Mayank S
ID: 8208053

Thread t = Thread.currentThread () ; // gets a reference to the current thread
t.setName ( "myThread" ) ; // sets a name for the current thread
String str = t.getName () ; // gets the name of the current thread


Expert Comment

ID: 9446806
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 
Post your closing recommendations!  No comment means you don't care.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 9449744
Well, I answered my own question :D

I only forgot about the question :(

here's a MSDN link to GetCurrentThreadId() :

LVL 30

Expert Comment

by:Mayank S
ID: 9451900
Recommendation: Accept mayankeagle's comment as answer. It meets the questioner's needs.

Expert Comment

ID: 9464038
mayankeagle, this is a win32 question, not a java question (I'm programming in delphi), sorry.

the name of a thread is not what I need.
I need the reference ID of the thread (that's generated by windows)

but nobody answered how to do THAT...

Accepted Solution

Chmod earned 0 total points
ID: 9481329
PAQ'd & points NOT refunded

Community Support Moderator @Experts Exchange

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question