Getting a handle to the process's main thread

前端 未结 5 2206
暖寄归人
暖寄归人 2020-12-10 13:06

I have created an additional thread in some small testing app and want to suspend the main thread from this additional thread. The additional thread is created via Cre

5条回答
  •  执念已碎
    2020-12-10 13:24

    I don't think there is anything that differentiates the main thread from other threads once the process has started. However, you can enumerate all threads in the process, and use GetThreadTimes to find the thread with the earliest creation time. Call OpenThread to get a HANDLE from a thread ID.

提交回复
热议问题