Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Install in every computer Custom Paper Size?
Message
 
 
To
29/10/2003 13:50:52
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00840704
Message ID:
00844248
Views:
31
>
>Now you are getting there! Getting around the external classes is a nice step. Works fine here on local and network printers (all on Win2K PCs). Now, how about a quickie form removal class? ;-)

No problem :-).
* Goes into LoadApiDlls
		DECLARE INTEGER DeleteForm IN winspool.drv;
			INTEGER hPrinter,;
			STRING  pFormName 

* DeleteForm method
	PROCEDURE DeleteForm(tcFormName, tcPrinterName)
	LOCAL lhPrinter, llSuccess

	IF PCOUNT() > 1
		This.cPrinterName = tcPrinterName
	ENDIF

	This.ClearErrors()
	lhPrinter = 0
	IF OpenPrinter(This.cPrinterName, @lhPrinter, 0) = 0
		This.cErrorMessage = "Unable to get printer handle for '" + This.cPrinterName + "."
		This.nApiErrorCode = GetLastError()
		This.cApiErrorMessage = This.ApiErrorText(This.nApiErrorCode)
		RETURN .F.
	ENDIF

	* Finally, call the API
	IF DeleteForm(lhPrinter, tcFormName) = 0
		This.cErrorMessage = "Unable to delete Form '" + tcFormName + "'."
		This.nApiErrorCode = GetLastError()
		This.cApiErrorMessage = This.ApiErrorText(This.nApiErrorCode)
		llSuccess = .F.
	ELSE
		llSuccess = .T.
	ENDIF
	= ClosePrinter(lhPrinter)
	RETURN llSuccess
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform