Узнать версию драйвера принтера
Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch
uses
Printers, Winspool;
procedure TForm1.FormCreate(Sender: TObject);
begin
ComboBox1.Items.Assign(Printer.Printers);
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
var
hPrinter: THandle;
PrtName: string;
DriverInfo: PDriverInfo2;
dwNeeded: DWORD;
begin
Memo1.Clear;
PrtName := Combobox1.Text;
OpenPrinter(PChar(PrtName), hPrinter, nil);
GetPrinterDriver(hPrinter, nil, 2, DriverInfo, 0, dwNeeded);
GetMem(DriverInfo, dwNeeded);
if GetPrinterDriver(hPrinter, nil, 2, DriverInfo, dwNeeded, dwNeeded) then
begin
// Add infos to Memo1
Memo1.Lines.Add('Version: ' + IntToStr(DriverInfo.cVersion));
Memo1.Lines.Add(StrPas(DriverInfo.pName));
Memo1.Lines.Add(StrPas(DriverInfo.pEnvironment));
Memo1.Lines.Add(StrPas(DriverInfo.pDriverPath));
Memo1.Lines.Add(StrPas(DriverInfo.pDataFile));
Memo1.Lines.Add(StrPas(DriverInfo.pConfigFile));
end
else
Memo1.Lines.Add('No Info needed = ' + IntToStr(dwNeeded));
ClosePrinter(hPrinter);
FreeMem(DriverInfo);
end;
|