>>>I need to use the Common Dialog to display the Printer Setup dialog. How do I detect if the user presses Cancel?
>>
>>You've to set CancelError=.T. and use error handler to capture error when Cancel button is clicked.
>
>Next question, now that I've been playing with this a bit. If PrinterDefault = .T., the dialog changes the Windows default printer, which is not acceptable. I need to have PrinterDefault = .F. When I do that, how do I determine which printer the user selected?
Microsoft Visual Studio 6.0 includes also a replacement of Common Dialogs control - The Microsoft Dialog Automation Objects. This component provides Common Dialog functionality without requiring that you place a control on a form. It's a DLGOBJS.DLL in VB98\Wizards\PDWizard directory.
You can easily get a printer name using DLGOBJS:
oPrnDlg = CreateObject("DlgObjs.PrintDialog")
If oPrnDlg.Show()
? oPrnDlg.PrinterDevice.Name
EndIf
But this tool is not supported by MS and not documented. All we have is a small readme file in \Tools\Unsupprt\DlgObj directory. If you want I can send a help file, generated from dlgobjs.dll.
Alexander