日期:2014-05-17 浏览次数:20897 次
using System.Management;
private string GetDefaultPrint()
{
string selectPrinterName = "";
string _select = "SELECT * FROM Win32_Printer";
ManagementObjectSearcher query = new ManagementObjectSearcher(_select);
ManagementObjectCollection printCollection = query.Get();
foreach (ManagementObject p in printCollection)
{
if(p. ("SetDefaultPrinter") != null) //如何判断?
{
selectPrinterName = p["Name"].ToString();
break;
}
}
return selectPrinterName;
}