procedure TForm1.Button1Click(Sender: TObject);
begin
ComboBox1.Items := Printer.Printers; {populates ComboBox}
ComboBox1.ItemIndex := Printer.PrinterIndex; {sets display to current printer}
end;
procedure TForm1.Button2Click(Sender: TObject);
var
Device: array[0..255] of Char;
Driver: array[0..255] of char;
Port: array[0..255] of char;
s : array[0..255] of Char;
hDeviceMode: THandle;
var
strIni: array[0..MAX_PATH] of Char;
arrWindows: array[0..64] of Char;
begin
GetWindowsDirectory(strIni, SizeOf(strIni));
StrCat(strIni, '\win.ini');
with TIniFile.Create(strIni) do
try
WriteString('windows', 'device', 'HP LaserJet 4 Plus,HPPCL5MS,LPT1:');
finally
Free;
end;