Why are documents printed out of order when you multiselect and choose “Print”?

Raymond Chen

If you select say five files and then right-click them and choose “Print”, they tend to print in a random order. Why is that?

The shell invokes the Print verb on each file in turn, and depending on how the program responsible for printing the document is registered, one of several things can happen.

  • Most commonly, the program that prints the document registered a simple command line under the shell\print\command registry key. In this case, the program is launched five times, each with a different file. All these print commands are now racing to the printer and it’s a question of which copy of the program submits its print job first that determines the order in which they come out of the printer. (You’re probably going to see the shortest and simplest documents come out first since they take less time to render.)
  • Occasionally, the program that prints the document registered a DDE verb under the shell\print\ddeexec registry key. In this case, one copy of the program is launched and it is given each filename one at a time. What it does with those filenames is now up to the program. If the program supports background printing, it will probably shunt the printing of the document onto a background thread, and now you’re roughly in the same fix as the previous scenario: Five background threads each racing to see who can submit their print job first.
  • Extremely rarely, the program that prints the document registered a drop handler under the shell\print\DropTarget key. In this case, the drop target is instantiated and is given the list of files. It is then up to the drop target to decide what to do with the documents.

These three ways of registering print actions are described in the MSDN documentation on verbs and file associations.

[Update: 7:30am, fixed title.]

0 comments

Discussion is closed.

Feedback usabilla icon