Use GetCurrentThread () or GetCurrentTreadId () and compare it with the known HANDLE or id of the main thread.
Can't have multiple user interface threads?
Of course, maybe, but only one main thread ui.
Ok But is there any way to find out the HANDLE or main thread identifier from this code? I mean something like GetMainThread or GetMainThreadID. I would like not to modify other parts of the application (if possible). BTW, Thanks for your reply.
Sorry, I had lunch and you have already received your answer. But can also answer. GetCurrentThreadId () can, of course, be used at runtime of your main ui thread and cached for later comparison. Somewhere during the execution of your application there will be only one thread, for example. in WinMain () before creating any other thread.
Greetings!
source share