C#显示当前计算机所有打印机名称,同时获取指定打印机的状态比如缺纸、缺墨等,并且生成记录日志和数据库,发送邮件通知当前打印出错消息,打包成exe安装文件——(一)封装打印机状态类型

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Management;
using System.Security;
using System.Printing;
using System.Net.Mail;
using System.Runtime.Remoting.Contexts;
using System.Net;
namespace ClassLibrary5
{
    public class PrinterHelper
    {
        public static string GetPrinterStatusByName(string PrinterName)
        {
            int intValue = GetPrinterStatusInt(PrinterName);
            string strRet = string.Empty;
            switch (intValue)
            {
                case 0:
                    strRet = "准备就绪(Ready)";
                    break;
                case 0x00000200:
                    strRet = "忙(Busy)";
                    break;
                case 0x00400000:
                    strRet = "被打开(Printer Door Open)";
                    break;
                case 0x00000002:
           

你可能感兴趣的:(C#显示当前计算机所有打印机名称,同时获取指定打印机的状态比如缺纸、缺墨等,并且生成记录日志和数据库,发送邮件通知当前打印出错消息,打包成exe安装文件——(一)封装打印机状态类型)