So I'm porting some classes from Win32 to .NET. One of these classes, based on TThread, calls SetThreadAffinityMask():

DWORD_PTR WINAPI SetThreadAffinityMask(
__in HANDLE hThread,
__in DWORD_PTR dwThreadAffinityMask
);

http://msdn2.microsoft.com/en-us/library/ms686247.aspx

I haven't had problems calling other API functions, but with this one I can't find the parameter needed. When I try to pass the handle of the Thread, this handle doesn't fit because it is of "Thread" type, not "Integer". I tried using IntPtr, but it doesn't seem capable to convert the handle. Is there a way to obtain the API handle of the thread? Just thought maybe I should call another API function to get the current thread handle, but if you have any idea please let me know.

Thanks!