Difference between OpenPrinter and OpenPrinterDialog

I was using PageSetupDialog and OpenPrinter to open the page setup dialog and printer dialog so the user can choose a printer and create a printer settings file. It was working just fine for quite a while. Now, some users periodically have a problem printing. The app just locks up. Some days it works, some days it doesn’t.

While setting up a new Windows 7 computer for a user I created a shortcut to the app (exe resides on a server) on the user’s desktop. When the app is run for the first time and the user chooses to print, the page setup dialog opens but not the printer dialog. The printer settings file also does not get created.

I replaced the OpenPrinter with OpenPrinterDialog and now the printer settings file is created and the printer dialog opens after the page setup dialog.

One thing I just noticed is on Windows XP the PageSetupDialog displays three buttons - OK, Cancel and Printers. On the Windows 7 box there are only two buttons displayed on the PageSetupDialog - OK and Cancel.

Thank you for your time.

So the question is, What’s the difference between OpenPinter and OpenPrinterDialog?

OpenPrinterDialog opens a printer selection window. OpenPrinter does not. On XP, the PageSetupDialog allowed you to select a printer as well. On Windows 7 it no longer does. So on Win7, you have to use OpenPrinterDialog explicitly if you want to allow the user to select a printer.