C++11’s standard library contains <thread> which allows threads to be created. However, the Windows api requires an ID for some functions (PostThreadMessage, namely). How can I get it?
remark: std::thread::get_id() doesn’t seem to work:
PostThreadMessage(m_thread->get_id(), WM_QUIT, 0, 0);
e:\documents\khook\khooker\hook_runner.cpp(129): error C2664: 'PostThreadMessageW' : cannot convert parameter 1 from 'std::thread::id' to 'DWORD'
Use the member function
native_handle(). It provides the native thread handle. Then you can callGetThreadId()on it.