How can I detect desktop changes ?

I capture it with GetDesktopWindow(), while there are, for example, 4 open windows
Later I close one of them, I'd like to get that change right after I close that window. I mean another HWND should be reported.

Thank you