How to get the winapi id of a thread that has been created using the standard library? How to get the winapi id of a thread that has been created using the standard library? windows windows

How to get the winapi id of a thread that has been created using the standard library?


Use the member function native_handle(). It provides the native thread handle. Then you can call GetThreadId() on it.


The thread::id class only allows comparison between ids and an output. It does not provide a means to access the actual underlying id. You could try outputting it to a stringstream and then parsing it back in, I guess.