How do I display the Find Printers dialog programmatically?

Raymond Chen

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 ICommon­Query::Open­Query­Window method. The Find­AD­Printers 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 Shell­Execute the saved search.


Discussion is closed.

Feedback usabilla icon