See the question and my original answer on StackOverflow

In most of the Shell API, a HWND handle can be passed, but it's optional, and it's also a way to say "disable UI".

This is the case for the IShellFolder::EnumObjects method

HRESULT EnumObjects(HWND hwnd, SHCONTF grfFlags, IEnumIDList **ppenumIDList);

hwnd parameter official documentation:

If user input is required to perform the enumeration, this window handle should be used by the enumeration object as the parent window to take user input. An example would be a dialog box to ask for a password or prompt the user to insert a CD or floppy disk. If hwndOwner is set to NULL, the enumerator should not post any messages, and if user input is required, it should silently fail.