How do I display the Find Printers dialog programmatically?
A customer wanted to display the Find Printers dialog programmatically to let the user pick a printer from Active Directory and wanted to know whether this was possible.
Yes, it’s possible, and there’s more than one way to do it. There’s the lazy way and the overachieving way.
The overachieving way is to use the
ICommonQuery::OpenQueryWindow method. The
FindADPrinters sample function spells it all out for you.
The lazy way takes a little bit of out-of-the-box thinking: Open the Find Printers dialog, set up the search the way you want it, and then save the search to a file (File, Save Search). In your program, when you need to open the Find Printers dialog, just
ShellExecute the saved search.