OllyDbg keeps list of active thread in a sorted data consisting of elements of type t_thread. You can receive pointer to table of threads by calling Plugingetvalue(VAL_THREADS) and casting result to (t_table *). If you know thread's identifier, Findthread will return pointer to thread descriptor. Plugingetvalue(VAL_MAINTHREADID) gives identifier of main thread of debugged process.
OllyDbg functions use thread identifiers, but some Windows functions require handles. Following code converts identifier to handle:
t_thread *pthread;
HANDLE hthread;
pthread=Findthread(threadid);
if (pthread!=NULL)
hthread=pthread->handle;
else
hthread=NULL;
Note that after application started and before OllyDbg received CREATE_PROCESS_DEBUG_EVENT event, thread's handle is unknown.
t_thread* Findthread(ulong threadid);
int Decodethreadname(char *s,ulong threadid,int mode);
ulong Getcputhreadid(void);
HWND Createthreadwindow(void);