窗体上有个TComBox,命名为cb1,为当前的所以打印机列表。
窗体名为Form1procedure 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;