I'm working on a somehow a small application in Winforms where I can see the printers I have on my application with detailed information similar the the configuration site of the printers. Every block of code I find online is either giving me false
when getting bool variables like this:
MachineName = "My Machine Name";
LocalPrintServer localPrintServer = new LocalPrintServer();
localPrintServer.Refresh();
PrintQueue pq = new PrintQueue(localPrintServer, MachineName.Trim());
pq.Refresh();
MessageBox.Show(pq.IsPrinting.ToString());
or I'm getting the "Win32 Access Denied" error like when using:
using (var ps = new PrintServer())
{
using (var pq = new PrintQueue(ps, MachineName, PrintSystemDesiredAccess.UsePrinter))
{
foreach (var job in pq.GetPrintJobInfoCollection())
MessageBox.Show("hi");
}
}
I'm out of ideas, thank you in advance.