Thread ID

  • Thread starter Thread starter Chad
  • Start date Start date
C

Chad

Is there a way to retrieve the thread ID in Visual
Basic.NET after you have started the thread?
 
There isn't a managed way of doing this, so, use the following API:

Public Declare Function GetCurrentThreadId Lib "kernel32.dll" () As Integer

And call it inside your Thread Proc:

Public Sub MyThreadProc()

Dim intThreadID As Integer = GetCurrentThreadId()
 
Back
Top