How to open driver properties with one click? Read the paper sizes from the driver and paste them into edit.

  • @ kirik1982, Please arrange the questions according to the rules of the community, otherwise they will be deleted. - Nicolas Chabanovsky

2 answers 2

Start | Control panel | Devices and Printers | Right click on the printer | Print setting

Read and insert where you want.

    uses Printers, WinSpool; //** function PrintDriverExists: boolean;//проверяем установлен ли принтер var Flags, Count, NumInfo: dword; Level: Byte; begin Count := 0; try if Win32Platform = VER_PLATFORM_WIN32_NT then begin Flags := PRINTER_ENUM_CONNECTIONS or PRINTER_ENUM_LOCAL; Level := 4; end else begin Flags := PRINTER_ENUM_LOCAL; Level := 5; end; EnumPrinters(Flags, nil, Level, nil, 0, Count, NumInfo); except end; result := (count > 0); end; //** function PrintSizeHEIGHTmm: Integer;//получаем высоту в миллиметрах var Y: integer; begin Y:= GetDeviceCaps(printer.Handle, LOGPIXELSY); Result:= round(GetDeviceCaps(printer.Handle, PHYSICALHEIGHT)*25.4/Y); end; //** function PrintSizeWIDTHmm: Integer;//получаем ширину в миллиметрах var X: integer; begin X:= GetDeviceCaps(printer.Handle, LOGPIXELSX); Result:= round(GetDeviceCaps(printer.Handle, PHYSICALWIDTH)*25.4/X); end; //** //Выводим в Edit if PrintDriverExists = true then begin Edit1.Text:=IntToStr(PrintSizeHEIGHTmm)+' X '+IntToStr(PrintSizeWIDTHmm); end;