Whenever I try to list the printers the Lazarus returns this error. This is my code: if Printer.Printers.Count > 0 then
begin
frmAJSelPrinter := TfrmAJSelPrinter.Create(nil);
try
This error happens here. Q At the time the printer will return
frmAJSelPrinter.lstimpressoras.Items := Printer.Printers; frmAJSelPrinter.lstimpressoras.ItemIndex:=0;
frmAJSelPrinter.ShowModal;
Imp := frmAJSelPrinter.lstimpressoras.Items[
frmAJSelPrinter.lstimpressoras.ItemIndex];
Printer.PrinterIndex:=frmAJSelPrinter.lstimpressoras.ItemIndex;
//Printer.SetPrinter(imp);
PrinterName := imp;
Printer.Copies := frmAJSelPrinter.spincopias.Value;
finally
frmAJSelPrinter.Free;
end;
end else begin
MessageDlg('Atenção', 'Nenhuma impressora esta instalada.',
mtWarning, [mbOK, mbCancel], 0);
end;