Delphi – Last printer used when printing with Fast Report (in Delphi)

delphifastreportwinapi

How to retrieve last user selected printer when printing from a preview window in Fast Report (Basic Edition ver. 4.7.1)?

I tried

frxReport.PrintOptions.Printer

in OnAfterPrintReport event but it only returns the system default printer.

After the user prints the report, the program prints a few Word documents and I need to know which printer was used last.

Best Solution

Using API Hook to store last used printer is a little too much, isn't it?

I found this better approach in the FastReport official forum:

S:=.../Load From Registry
frxreport1.PrintOptions.Printer:=S;//thats the last selected printer
frxreport1.Print;
S:=frxPrinters.Items[frxPrinters.PrinterIndex].Name;//thats a global var defined in frxPrinter
//Save S to Registry.
Related Question