Get printer drivers directory

Posted in System info

Use GetPrinterDriverDirectory function for solving of this problem. Don't forget include WinSpoon to uses chapter.

uses WinSpool;
... 
procedure TForm1.Button1Click(Sender: TObject);
var
  NewDevMode: TDeviceModeA;
  MyDir: PChar;
  Int: Integer;
begin
  GetMem(MyDir, 500);
  GetPrinterDriverDirectory(nil, nil, 1, MyDir, 200, Int);
  Label1.Caption:=StrPas(MyDir);
  FreeMem(MyDir);
end;