Holy cow, I wrote a book!
When you visited a computer on the network
by typing \\computername into the address bar,
Explorer showed you a Printers folder if the
computer had printer sharing enabled.
But starting in Windows Vista, the Printers folder
is shown regardless of whether the remote computer is
sharing any printers.
Why did this change?
Communicating with the remote computer
to ask it about its printers simply took too long.
The IShellFolder::EnumObjects method returns an
enumerator that produces a list of items in the folder.
Think of it as the shell namespace version of FindFirstFile.
When the IEnumIDList::Next method is called, it must
produce the next item in the folder or return a code that means
Sorry, no more items.
There is no return code that means
Hey, deciding on the next item is going to take a while,
so maybe you should go do something else for a while and check
back later when I finally have an answer for you.
FindNextFile doesn't have such a return code either.
It returns the next file or says No more files.
(Yes, there are also other errors that can be returned,
but they aren't important here.)
Now, Explorer does the enumeration of folder contents on a background
thread, so the UI remains responsive while all this querying is going on
to determine whether or not to show the Printers folder,
but a responsive UI is scant consolation if it's a responsive Please
If you went to a remote computer,
the folder would show a flashlight while the background thread did its thing,
and then two minutes later (or sometimes longer),
it finally would show you what it found.
That's two minutes of your life you can't get back.
(I predict people will use that one sentence as an excuse to go off-topic.)
As I've quipped before,
the fastest code is the code that never runs.
Instead of trying to figure out whether a remote computer is sharing
any printers with you,
just show a Printers folder icon.
Users who are interested in seeing the printers can double-click the
Printers folder icon,
and then they won't be too surprised to find that they have to wait
a while for the remote computer to respond with its list of printers.
Which might be empty.