Michael Mullan
1-Mar-2010, 03:34 PM
from the Integration code in cVisualReport.PKG
// Prints the report
// If the optional hPrinterDc is not passed or when it is zero Visual Report Writer will
// popup a print dialog to choose a printer from. When you do not want a printer dialog
// (for example because the information is stored in a record or file) you need to pass
// the handle to the printer DC.
Procedure PrintReport Handle hPrinterDc
How do I get the handle for the default printer?
I want to add a button to a view which prints a single page report with no further clicks or dialogs.
I've hacked it down to this,
Use cVisualReport.pkg
Object oInstantReport is a cVisualReport
End_Object
Procedure PrintInstantReport
Integer iReportID
String sFilterFunction
String sFromMemberMemid
Move 3445 to sFromMemberMemid // hard coded for testing.
Move (sFormat('Return ({MEMBER.Memid} = "%1")',sFromMemberMemid)) to sFilterFunction
Set psReportName of oInstantReport to "memberCard.vrw"
Set peOutputDestination of oInstantReport to PRINT_TO_PRINTER
Set psFilterFunction of oInstantReport to sFilterFunction
Get OpenReport of oInstantReport to iReportId
Set piReportId of oInstantReport to iReportID
Send PrintReport of oInstantReport
Send Request_Cancel
End_Procedure
So, how do I get the handle for the default printer to make this work?
// Prints the report
// If the optional hPrinterDc is not passed or when it is zero Visual Report Writer will
// popup a print dialog to choose a printer from. When you do not want a printer dialog
// (for example because the information is stored in a record or file) you need to pass
// the handle to the printer DC.
Procedure PrintReport Handle hPrinterDc
How do I get the handle for the default printer?
I want to add a button to a view which prints a single page report with no further clicks or dialogs.
I've hacked it down to this,
Use cVisualReport.pkg
Object oInstantReport is a cVisualReport
End_Object
Procedure PrintInstantReport
Integer iReportID
String sFilterFunction
String sFromMemberMemid
Move 3445 to sFromMemberMemid // hard coded for testing.
Move (sFormat('Return ({MEMBER.Memid} = "%1")',sFromMemberMemid)) to sFilterFunction
Set psReportName of oInstantReport to "memberCard.vrw"
Set peOutputDestination of oInstantReport to PRINT_TO_PRINTER
Set psFilterFunction of oInstantReport to sFilterFunction
Get OpenReport of oInstantReport to iReportId
Set piReportId of oInstantReport to iReportID
Send PrintReport of oInstantReport
Send Request_Cancel
End_Procedure
So, how do I get the handle for the default printer to make this work?