2

I already turned off the printer, and my code still returns None

Here is my code

try


 {
printServer.Refresh();
        PrintQueue printQueue = new PrintQueue(printServer, cmbPrinters.Text.Trim());
printQueue.Refresh();
        if (printQueue.QueueStatus == PrintQueueStatus.Offline)
        {
            MessageBox.Show("Offline");
        }
        else if (printQueue.QueueStatus == PrintQueueStatus.None)
        {
            MessageBox.Show("None");
        }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }

I am expecting that it should return offline because I turned it off.

How can I fix this issue? Anyone? Any suggestions or advice will be a big help.

Thanks!

SHINHAN
  • 685
  • 2
  • 12
  • 28
  • When the printer is on, do you see the correct queue status? – drf May 04 '13 at 03:38
  • @drf, yeh the isShared and isToner only, am i missing something? – SHINHAN May 04 '13 at 03:40
  • @drf, sir do you know other ways? I really need it badly :( – SHINHAN May 04 '13 at 03:45
  • If you try printing something to the printer while it is offline and then execute your code, do you see the correct status? Per http://support.microsoft.com/kb/160129: "A system Printer reports no status when the Printer queue is empty. In this state, the Printer is assumed ready to accept print jobs." – drf May 04 '13 at 03:49
  • im just trying to check if printer is offline/outofpaper/paperjammed – SHINHAN May 04 '13 at 03:54
  • I think the issue is that if there are no jobs in queue, there will be no print queue status. You can try querying a document while print jobs are in queue to see if you get the correct status. If you need the status before you print to queue, you could try using the WMI Win32_Printer class (see, e.g., http://stackoverflow.com/questions/13966188/how-to-use-win32-classes-like-win32-printer). – drf May 04 '13 at 04:23
  • @drf, I heard WMI also is not stable cant properly detect printer issues, – SHINHAN May 04 '13 at 04:34
  • same problem here, have you resolved? thanks – GibboK Jan 16 '14 at 07:59

0 Answers0