Assembly : System.Management;
public bool CheckPrinterStatus()
{
ManagementScope scope = new ManagementScope(@"\root\cimv2");
scope.Connect();
// Select Printers from WMI Object Collections
ManagementObjectSearcher PrinterCollection= new
ManagementObjectSearcher("SELECT * FROM Win32_Printer");
string printerName = "";
foreach (ManagementObject printer in PrinterCollection.Get())
{
printerName = printer["Name"].ToString().ToLower();
if (printerName.Equals(@"hp laserjet 1018"))
{
MessageBox.Show("Printer = " + printer["Name"]);
if (printer["WorkOffline"].ToString()=="True")
{
// Printer is offline
MessageBox.Show("Printer is not Connected.");
return false;
}
else
{
// Printer is Online
MessageBox.Show("Printer is Connected.");
return true;
}
}
}
}
Subscribe to:
Post Comments (Atom)
Mat Table Angular
Mat Table in Angular Mat table is used to display data . its a material designed styled data-table . For using Material Table MatTableMo...
-
CriteriaOperator criteria = new BinaryOperator("Age", 30, BinaryOperatorType.Greater); CriteriaOperator criteria = CriteriaOperato...
-
SortingCollection sc = new SortingCollection(); sc.Add (new SortProperty("field on which you want to sort",DevExpress.Xpo.DB.Sorti...
-
Here ItemName will be Enable/Disable According to IsApplicable Property Assembly: DevExpress.XtraLayout; DevExpress.ExpressApp.Win.Layou...
No comments:
Post a Comment