Author: Jonas Bilinkevicius
Is there any API call that opens the printer properties window? You can open it
clicking the right mouse button in a printer icon and choosing properties from the
context menu.
Answer:
1 uses2 WinSpool;
3 4 procedure TForm1.Button2Click(Sender: TObject);
5 var6 hPrinter: THandle;
7 Device: array[0..255] of char;
8 Driver: array[0..255] of char;
9 Port: array[0..255] of char;
10 hDeviceMode: THandle;
11 begin12 {can use other index than default or omit this statement if printer 13 already selected}14 Printer.PrinterIndex := -1;
15 Printer.GetPrinter(Device, Driver, Port, hDeviceMode);
16 if WinSpool.OpenPrinter(@Device, hPrinter, nil) then17 try18 PrinterProperties(Handle, hPrinter);
19 finally20 WinSpool.ClosePrinter(hPrinter);
21 end;
22 end;