PrintDialog - PrintDialog
Used to display the print dialog box
Type: Function
Return Data Type: Integer
Syntax
Function PrintDialog Returns Integer
Call Example
Get PrintDialog to IntegerVariable
Description
PrintDialog is used to display the Print dialog box.
This function sets the properties to reflect the users choices. If the user clicks the OK button, the return value is zero. If the user cancels the dialog or an error occurs the return value is non-zero.
Normally this is considered to be a private method and it is not expected that this function will ever get called directly. This function allocates memory that is not automatically freed when you call this function directly. If you do call this function, you must make sure that you deallocate the memory assigned to this function. If you use this function you are encouraged to review the method CrystalReport.SelectAndSetPrinter in the CrystalReport class as this shows how PrintDialog is safely used.
Procedure DoSetPrinter
String sDriver sDevice sPort
Integer iResult
Pointer pHeap
Get PrintDialog of oPrintDialog To iResult
If (iResult) Procedure_Return
Get DeviceName of oPrintDialog To sDevice
Get OutputName of oPrintDialog To sPort
:
:
// Unlock and free allocated memory
Move (GlobalUnlock(DevModeHandle(oPrintDialog))) To iResult
Move (GlobalFree(DevModeHandle(of oPrintDialog))) To iResult
Move (GlobalFree(DevNamesHandle(of oPrintDialog))) To iResult
End_Procedure
Return Value
Returns non zero if an error occurred