$PBExportHeader$eaf_n_cst_printerservice.sru forward global type eaf_n_cst_printerservice from n_cst_baseservice end type end forward global type eaf_n_cst_printerservice from n_cst_baseservice end type global eaf_n_cst_printerservice eaf_n_cst_printerservice type variables end variables forward prototypes public function long setprinter (string as_printername) end prototypes public function long setprinter (string as_printername);//////////////////////////////////////////////////////////////// // Description: // Set the printer using the PB set printer capabilities // Revisions // 3.0 - Initial version // Arguments: // as_printername - name of printer // Returns: // 1 - Success // -1 - Failure //////////////////////////////////////////////////////////////// // Copyright © 2000 - 2007 Youngsoft, Inc. All rights reserved. // Any distribution of the Youngsoft, Inc. Enterprise Application Framework // source code in whole or part by other than Youngsoft, Inc. is prohibited. //////////////////////////////////////////////////////////////// constant string METHOD_NAME = "setPrinter( string ) " n_cst_stringservice lnv_string string ls_printerlist string ls_printers[] long ll_printerindex long ll_printercount try lnv_string = create n_cst_stringservice // Get the list of printers ls_printerlist = printGetPrinters() lnv_string.parseStringToArray( ls_printerlist, "~n" , ls_printers) ll_printercount = upperBound( ls_printers ) // Look for the printer in the list for ll_printerindex = 1 to ll_printercount if pos ( lower (ls_printers[ll_printerindex]), lower (as_printername) ) > 0 then // Found it - set it to the default printer if printSetPrinter (ls_printers[ll_printerindex]) = -1 then addError( METHOD_NAME, "Failed to set printer using printer name " + ls_printers[ll_printerindex] ) return -1 else return 1 end if end if next finally if isValid( lnv_string ) then destroy lnv_string end if end try // Could not find the printer addError( METHOD_NAME, "Failed to locate printer (" + as_printername +") in list of printers" ) // Should not have reached here return -1 end function on eaf_n_cst_printerservice.create call super::create end on on eaf_n_cst_printerservice.destroy call super::destroy end on
- Sources
- EAF.NET
- eaf_shared
- eaf_n_cst_printerservice.sru
File: eaf_n_cst_printerservice.sru
Size: 2402
Date: Tue, 22 Jan 2008 23:39:12 +0100
Size: 2402
Date: Tue, 22 Jan 2008 23:39:12 +0100
- n_cst_baseservice eaf_n_cst_printerservice(sru)