Get the selected printer device name

From DataFlex Wiki
Jump to navigationJump to search

DataFlex Reports has a class cPrintDialog which you can use to popup a printer dialog and then retrieve the selected printer from.

    Object oPrintDialog is a cPrintDialog
    End_Object

    Object oPrint is a Button
        Set Location to 0 0
        Set Label to "Print"
    
        Procedure OnClick
            Integer iRes
            String  sPrntr
            
            Get PrintDialog of oPrintDialog to iRes
            
            If iRes Begin
                Get psDeviceName of oPrintDialog to sPrntr
                
                Direct_Output ("WinLST:" * sPrntr)
                Writeln "Hello World!"
                Close_Output
            End
            
        End_Procedure
    
    End_Object

External links