Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Common Dialog
Message
 
To
16/05/2002 18:07:55
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00657801
Message ID:
00658015
Views:
26
>>>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()    && Returns TRUE when OK pressed and FALSE when CANCEL
	? 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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform