I am trying to install a virtual printer (for all versions of Windows) with a Windows desktop application. I want this printer to be available in the drop down list in the print dialog (especially from Office).
I am trying with this code:
public static void installPrinter(string printerName)
{
string arg;
arg = "printui.dll , PrintUIEntry /if /b " + "\"" + printerName + "\"" + @" /f C:\Windows\inf\ntprint.inf /r " + "\"" + "lpt1:" + "\"" + " /m " + "\"" + "Brother DCP-116C" + "\""; //initial args
ProcessStartInfo p = new ProcessStartInfo();
p.FileName = "rundll32.exe";
p.Arguments = arg;
p.WindowStyle = ProcessWindowStyle.Hidden;
try
{
Process.Start(p);
}
catch (Exception ex)
{
MessageBox.Show(ex.InnerException.ToString());
}
}
but it doesn't work. Any suggestions?