If we created the window, it needs to be closed after setting a new window id. https://bugzilla.gnome.org/show_bug.cgi?id=574290
To build this, you'll require the DirectShow base classes. These are supplied in the Windows SDK, but under Samples\Multimedia\DirectShow\BaseClasses Once you've built that, you should be able to figure out the rest...