问题描述
enumPrinterStatus{其他状态=1,未知,空闲,正在打印,预热,停止打印,打印中,离线}privatePrinterStatusGetPrinterStatus(stringPrinterDevice){PrinterStatusret=0;stringpath=@"win32_printer.DeviceId='"+PrinterDevice+"'";ManagementObjectprinter=newManagementObject(path);printer.Get();ret=(PrinterStatus)Convert.ToInt32(printer.Properties["PrinterStatus"].Value);returnret;}privatevoidbutton1_Click(objectsender,EventArgse){MessageBox.Show(GetPrinterStatus("\\UF6JAKRECW5S0IE\HPLaserJetProfessionalM1136MFP").ToString());}获取到的状态一直是空闲!!应该怎么写?有人可以帮我吗?使用API的话应该怎么用??
解决方案
时间: 2024-10-01 02:16:06