Skip to content

DRPrinterDevMode - cPrintDialog

Methods - Properties

Method Type

Function

Arguments

Argument Description
sPrinterName Name of one of the printers in the environment

Description

Attempts to read DEVMODE data from a specified printer, which is necessary to support psPrinterName.

Pass the name of one of the registered printers in the environment. The method tries to open the printer to retrieve information from its driver. If the opening is successful, the DEVMODE structure of the printer is read, and the ReadDevModeData method is executed to parse the information from the structure. Subsequently, psDeviceName, psOutputName, and psDriverName are set if they differ from the currently available information. When these names are changed, the property is marked as changed, allowing decisions to be made based on these modified values.

The information from DEVMODE and DEVNAMES is stored in the properties phDevNames and phDevMode.

After retrieving DEVMODE and DEVNAMES information, the Windows print dialog is invoked silently, and the phPrintDlg property is set to the returned information. The value of this property is crucial for printing, as it is passed to the DataFlex Reports OCX to print the report results.

Sample

Object oReport is a cDRReport
    Set psReportName to 'MyReport.dr'
End_Object

Procedure ShowDefaultPrinterName
    Handle hoPrintDialog
    String sPrinterName
    Boolean bOk

    Get phoPrintDialog of oReport to hoPrintDialog
    Get DefaultPrinter of hoPrintDialog to sPrinterName
    Get DRPrinterDevMode of hoPrintDialog sPrinterName to bOk
End_Procedure