How can I be notified when a new window is created on Win32?
Sure - you can write a CBT hook and watch for HCBT_CREATEWND
. See also SetWindowsHookEx()
.
Note that this will allow you to be notified of all window creation, before the windows being created are even fully initialized. If all you need are unowned, top-level windows, RichieHindle's suggestion may work better...
Use SetWindowsHookEx
to set up a WH_SHELL
hook and look for the HSHELL_WINDOWCREATED
event.