#!perl -w use Win32 qw(SW_SHOWNORMAL); use Win32::API; use strict; my $shellexec = Win32::API->new('shell32', 'ShellExecute', 'NPPPPI', 'N') or die "cannot import ShellExecute: $!\n"; for my $filename ( "small.pdf", "realfilebutunknownextension.qqt", "notanexistingfile.doc", "knownextbutnoprint.wpl") { my $result = $shellexec->Call(0, "print", $filename, "", ".", SW_SHOWNORMAL); my $msg = ($result>32)?"Success": Win32::FormatMessage($result); printf "ShellExecute(, \"print\", \"%s\", ...) => %s\n", $filename, $msg; }