I need to get the default printer name. I\'ll be using C# but I suspect this is more of a framework question and isn\'t language specific.
Another approach is using WMI (you'll need to add a reference to the System.Management assembly):
public static string GetDefaultPrinterName()
{
var query = new ObjectQuery("SELECT * FROM Win32_Printer");
var searcher = new ManagementObjectSearcher(query);
foreach (ManagementObject mo in searcher.Get())
{
if (((bool?) mo["Default"]) ?? false)
{
return mo["Name"] as string;
}
}
return null;
}