Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 9 Report Listener - Error Loading Printer Driver
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
VFP 9 Report Listener - Error Loading Printer Driver
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01135998
Message ID:
01135998
Views:
210
I receive the error 'Error Loading Printer Driver' when using the custom Report Listener in PREVIEW mode and the user clicks the print button on the preview toolbar.

The error does not occur when using the standard VFP preview mode or when printing directly.

The code I am testing (listed below) is a sample from fox.wikis.com. I created a very simple report form called test.frx without saving the printer environment for use by the example.
CREATE CURSOR test (cdata char(20))
APPEND blank
*Modeled after sample code at http://fox.wikis.com/wc.dll?Wiki~ReportListener~VFP 
*...
*Code to instantiate the listener object and run the report.
#INCLUDE reportlisteners.h
Set Classlib To Home()+"\ffc\_reportlistener.vcx" additive

#DEFINE DebugListener -2
#DEFINE PrintListener 0
#DEFINE PreviewListener 1
#DEFINE XMLListener 4
#DEFINE HTMLListener 5

#DEFINE PreviewMode '1'
#DEFINE PrintMode '2'

**Custom Listener
Local oListener as object
oListener = NEWOBJECT("ltListener")
oListener.ListenerType = PreviewListener 

***Run Report
REPORT FORM "test.frx" TO PRINTER PROMPT OBJECT olistener

RETURN

*+------------------------------------------------------
*| Custom Listener Class named: "ltListener"
*+------------------------------------------------------
DEFINE CLASS ltListener AS utilityreportlistener
************* Instance Specific Properties

	*+---------------------------------------------------------
	*| *** Parent Method Customizations ***
	*+---------------------------------------------------------
	*+---------------------------------------------------------
	*| Error() **Inherited Method
	*| Triggered when an Error occurs while running the report.
	*+---------------------------------------------------------
	Procedure Error(nError, cMethod, nLine)
		DoDefault(nError, cMethod, nLine)
		Set Step On
	ENDPROC

	*+---------------------------------------------------------
	*| OnPreviewClose() **Inherited Method
	*| Triggered when an Error occurs while running the report.
	*+---------------------------------------------------------
	Procedure OnPreviewClose(lPrint)
		IF lPrint	&& User clicked Print button!
			*** Set variable flag here, or whatever
			WAIT WINDOW "It's rollin', baby!"
		ENDIF
		DoDefault(lPrint)
	ENDPROC
ENDDEFINE
Aubrey
Next
Reply
Map
View

Click here to load this message in the networking platform