$PBExportHeader$n_addprinter.sru forward global type n_addprinter from nonvisualobject end type type startupinfo from structure within n_addprinter end type type process_information from structure within n_addprinter end type end forward type startupinfo from structure long cb string lpreserved string lpdesktop string lptitle long dwx long dwy long dwxsize long dwysize long dwxcountchars long dwycountchars long dwfillattribute long dwflags long wshowwindow long cbreserved2 long lpreserved2 long hstdinput long hstdoutput long hstderror end type type process_information from structure long hprocess long hthread long dwprocessid long dwthreadid end type global type n_addprinter from nonvisualobject autoinstantiate end type type prototypes Function boolean CreateProcess ( & string lpApplicationName, & Ref string lpCommandLine, & long lpProcessAttributes, & long lpThreadAttributes, & boolean bInheritHandles, & long dwCreationFlags, & long lpEnvironment, & string lpCurrentDirectory, & STARTUPINFO lpStartupInfo, & Ref PROCESS_INFORMATION lpProcessInformation & ) Library "kernel32.dll" Alias For "CreateProcessA" Function long WaitForSingleObject ( & long hHandle, & long dwMilliseconds & ) Library "kernel32.dll" Function boolean CloseHandle ( & long hObject & ) Library "kernel32.dll" end prototypes type variables end variables forward prototypes public function boolean of_addprinter (string as_infname, string as_drvname, string as_ptrname) public function boolean of_adddatawindowps (string as_infname) end prototypes public function boolean of_addprinter (string as_infname, string as_drvname, string as_ptrname);// ----------------------------------------------------------------------------- // SCRIPT: n_addprinter.of_AddPrinter // // PURPOSE: This function adds a printer using an .inf file. // // ARGUMENTS: as_infname - Full path name of the .inf file // as_drvname - The name of the driver in the .inf // as_ptrname - The name of the printer // // RETURN: True=Process Created, False=Create Process failed // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 02/11/2011 RolandS Initial Coding // ----------------------------------------------------------------------------- CONSTANT Long INFINITE = -1 PROCESS_INFORMATION lstr_pi STARTUPINFO lstr_si String ls_null, ls_cmdline // initialize arguments lstr_si.cb = 72 SetNull(ls_null) // build command line ls_cmdline = "rundll32.exe printui.dll,PrintUIEntry /if /f ~"" + as_infname + "~"" + & " /r ~"file:~" /m ~"" + as_drvname + "~" /b ~"" + as_ptrname + "~"" // create process and execute the command If CreateProcess(ls_null, ls_cmdline, 0, & 0, False, 0, 0, ls_null, lstr_si, lstr_pi) Then // wait until process ends WaitForSingleObject(lstr_pi.hProcess, INFINITE) // close process and thread handles CloseHandle(lstr_pi.hProcess) CloseHandle(lstr_pi.hThread) Else // return failure Return False End If Return True end function public function boolean of_adddatawindowps (string as_infname);// ----------------------------------------------------------------------------- // SCRIPT: n_addprinter.of_AddDataWindowPS // // PURPOSE: This function adds the DataWindow Ghostscript printer. // // ARGUMENTS: as_infname - Full path name of the .inf file // // RETURN: True=Process Created, False=Create Process failed // // DATE PROG/ID DESCRIPTION OF CHANGE / REASON // ---------- -------- ----------------------------------------------------- // 02/11/2011 RolandS Initial Coding // ----------------------------------------------------------------------------- Return of_AddPrinter(as_infname, "Ghostscript PDF", "Sybase DataWindow PS") end function on n_addprinter.create call super::create TriggerEvent( this, "constructor" ) end on on n_addprinter.destroy TriggerEvent( this, "destructor" ) call super::destroy end on
- Sources
- TopWiz
- printerinstall
- PB8
- n_addprinter.sru
File: n_addprinter.sru
Size: 4179
Date: Sun, 01 Jan 2017 20:28:11 +0100
Size: 4179
Date: Sun, 01 Jan 2017 20:28:11 +0100
- nonvisualobject autoinstantiate n_addprinter(sru)