6

I'm using Delphi's winapi ShellExecute to try to print to a user selected printer and not the default printer. I'm trying to figure out the syntax for a command using the printto verb.

What would an example shell execute statement look like if I wanted to print manual.pdf to a HP Laser Jet 4 with IP address 192.168.1.49?

(this is just an example, but if you can help me out, I can take it from there)

Peter Turner
  • 11,199
  • 10
  • 68
  • 109

1 Answers1

3

You need to pass the network network address of the printer in the arguments parameter.

ShellExecute(
  WindowHandle,
  'printto',
  PChar(DocumentName),
  PChar(PrinterNetworkAddress),
  nil,
  SW_HIDE
);
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • 1
    How do you get the network address address / what's the difference between that and what is returned as the port int Printer.GetPrinter? mjn's code works for me, but I'd rather use this. – Peter Turner Jun 05 '12 at 14:37