I am monitoring the creation/destruction of Windows Explorer and Internet Explorer windows using DShellWindowsEvents.WindowRegistered
and DShellWindowsEvents.WindowRevoked
. The WindowRegistered event gives you the cookie value associated with the window (documentation). If I want to get the IDispatch interface of a given window, the documentation for IShellWindows::FindWindowSW()
seems to indicate that you can do so by passing SWFO_COOKIEPASSED
in the swfwOptions
argument (documentation). However, I have been unable to make this work any way I've tried it. What is the piece I'm missing? If the documentation is correct, can someone point me to a sample where the FindWindowSW() method is called using a cookie value to locate the window?