Hello All,
I have a requirement in advanced installer below
1. I need a custom action to get list of local & network printers.
2. Using the custom action i have bind the printers to combobox.
any help on the above...
Thanks in advance
Indeed, to get the list of the local & network printers you need to create a custom action. Please take a look on the How to get the list of all printers in computer thread which debates this subject.1. I need a custom action to get list of local & network printers.
To integrate your custom action in Advanced Installer, please take a look on the Options to integrate and debug custom actions article with related information for hints and guidance.2. Using the custom action i have bind the printers to combobox.
Code: Select all
public class CustomActions
{
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
session.Log("Begin CustomAction1");
const string SEP_2 = "|";
string AIComboData = "MY_COMBO";
PrinterSettings aPrinterSettings = new PrinterSettings();
foreach (string printer in PrinterSettings.InstalledPrinters)
{
// populate the ComboBoxData with this format
AIComboData += SEP_2 + printer ;
// code nedded to detect the default printer
// display default printer as default value in the comboBox control
aPrinterSettings.PrinterName = printer;
if (aPrinterSettings.IsDefaultPrinter)
{
session["MY_COMBO"] = aPrinterSettings.PrinterName;
}
}
// Set the Property that will be used as input by the AI PopulateComboBox
session["AI_COMBOBOX_DATA"] = AIComboData;
return ActionResult.Success;
}
}
}
FOLLOW US
Get the latest news in Application Packaging