procedure TForm1.FormCreate(Sender: TObject);
begin
cb1.items.assign(printer.printers);
end;
procedure TForm1.Button1Click(Sender: TObject);
var LPrinter:string;
PrinIniFile:Tinifile;
LStr:string;
begin
LStr:=printer.Printers[cb1.itemindex];
delete(Lstr,pos(' on ',Lstr),Length(LStr));
PrinIniFile:=TIniFile.Create('WIN.ini');
try
LPrinter:=PrinIniFile.ReadString('Devices',LStr,'');
PrinIniFile.writestring('windows','device',LStr+','+LPrinter);
finally
PrinIniFile.free;
end;
end;