How i can discover if my printer is off?

How i can discover if my printer is off?

Postby Caio » Wed Feb 08, 2012 3:48 pm

hello, i've been searching a lot of functions on xharbour and fivewin, but i didn't found one to discover if my printer is offline.
someone can help me??

thanks,
Caio Richetti
Caio
 
Posts: 1
Joined: Thu Nov 24, 2011 2:14 pm

Re: How i can discover if my printer is off?

Postby ukoenig » Wed Feb 08, 2012 4:43 pm

FWH-function :

PrnStatus( <cPrinter> ) --> nStatus

Parameters:

<cPrinter> The printer of which the status is to be retrieved.

Returns: <nStatus> One of the following values:

#define PRINTER_STATUS_OK 0
#define PRINTER_STATUS_PAUSED 1
#define PRINTER_STATUS_ERROR 2
#define PRINTER_STATUS_PENDING_DELETION 4
#define PRINTER_STATUS_PAPER_JAM 8
#define PRINTER_STATUS_PAPER_OUT 16
#define PRINTER_STATUS_MANUAL_FEED 32
#define PRINTER_STATUS_PAPER_PROBLEM 64
#define PRINTER_STATUS_OFFLINE 128
#define PRINTER_STATUS_IO_ACTIVE 256
#define PRINTER_STATUS_BUSY 512
#define PRINTER_STATUS_PRINTING 1024
#define PRINTER_STATUS_OUTPUT_BIN_FULL 2048
#define PRINTER_STATUS_NOT_AVAILABLE 4096
#define PRINTER_STATUS_WAITING 8192
#define PRINTER_STATUS_PROCESSING 16384
#define PRINTER_STATUS_INITIALIZING 32768
#define PRINTER_STATUS_WARMING_UP 65536
#define PRINTER_STATUS_TONER_LOW 131072
#define PRINTER_STATUS_NO_TONER 262144
#define PRINTER_STATUS_PAGE_PUNT 524288
#define PRINTER_STATUS_USER_INTERVENTION 1048576
#define PRINTER_STATUS_OUT_OF_MEMORY 2097152
#define PRINTER_STATUS_DOOR_OPEN 4194304
#define PRINTER_STATUS_SERVER_UNKNOWN 8388608
#define PRINTER_STATUS_POWER_SAVE 16777216

Sample: SAMPLES\prnstat.prg


Another Solution : You can run a VB-Script that scans the Status of all installed Printers

Click on the File or run from inside Your App.
Winexec('WSCRIPT.exe PRINTER.VBS')

Save as : Printer.vbs

Code: Select all  Expand view

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters =  objWMIService.ExecQuery _
    ("Select * from Win32_Printer Where PrinterStatus = '1' " _
        & "or PrinterStatus = '2'")

If colInstalledPrinters.Count = 0 Then
    Wscript.Echo "All printers are functioning correctly."
Else
    For Each objPrinter in colInstalledPrinters
        Wscript.Echo "Printer " & objprinter.Name & " is not responding."
    Next
End If 
 


Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: How i can discover if my printer is off?

Postby dutch » Sat Sep 14, 2013 3:55 am

Dear All,

Samples\PrnStat.prg.

Does it work with Print Server or Shared Printer?

Thanks in advance,
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 92 guests