printer.printers.count可以得到打印机数
printer.printers可以得到打印机列表
printer.printerINDEX可以设当前打印机
printer.printerINDEX:=-1可以恢复默认打印机
改变缺省的打印机配置
procedure TForm1.MakeDefaultPrinter;
var
WinIni : TIniFile;
WinIniFileName : array[0..MAX_PATH] of char;
begin
GetWindowsDirectory(WinIniFileName,sizeof(WinIniFileName));
StrCat(WinIniFileName, '/win.ini');
WinIni := TIniFile.Create(WinIniFileName);
try
WinIni.WriteString('windows', 'device','HP LaserJet Series II,HPPCL,LPT1:');
~~~~~~~~~~~~~~~~~~~~~
finally
WinIni.Free;
end;
end;