Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

WinEventHook: what happen when the thread that installed the event hook ends?

I did some testing and noticed that when the thread that installed an event hook ends (or is killed) the callback function is no longer called, as if the hook ended together with the thread.

However, the documentation says to call UnhookWinEvent from the same thread that installed the event, which is not possible if the thread is no longer alive.

Therefore, if the thread that installed the event hook terminates unexpectedly before calling UnhookWinEvent, what happens? Does some problem occur? Or does the event hook terminate together with the thread, as if UnhookWinEvent had been called?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You probably ought to have read that documentation you linked to:

If the client’s thread ends, the system automatically calls this
function.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading