Re: printing all kind of files by Alex
Alex
Fri Jun 09 05:35:51 CDT 2006
sonijindal@gmail.com wrote:
> first of all thanx...
> I tried ShellExecute() with "print" parameter. But I read
> that this can print only document files. Probably because
> of this reason when i am trying to print jpeg files it
> simply opens the file in the windows picture and fax
> viewer instead of printing it directly. Similarly for ppt
> it opens the print dialog. Instead i want these files to
> directly print instead of asking anything. Please tell me
> how can i do this. And also tell me what does this mean:
>
>> You can print any file on Windows if it has associated
>> program, which will handle printing.
Many file extensions on Windows have associated programs
with them. E.g., when you click on .doc file, then MS Word
opens it, when you click on .mp3 file, Windows Media Player
will open it, or any other program, which is currently
associated with .mp3 extension. Program that associates
itself with some file type usually knows how to open it and,
if file can be printed, how to print it.
There are several common actions that usually performed
while working with file. Windows Shell decided that these
actions are common enough to provide unified mechanism of
handling and registering these actions. So, any application
can choose extensions it want to be associated with and
action (verb) it will handle.
ShellExecute documentaion calls editable files as
"documents". Because, usually user wants to print what
he/she can edit (for example, Word or image file). There is
no common way to print .mp3, though. Most MS Office
documents can be printed programmatically because there are
associated handlers of "print" action. Also, many programs
provide command-line switches to enable programmatic
printing (besides other things), for example Adobe Acrobat
Reader can print .pdf files via command-line switches. You
will need to read program's documentation to figure out
whether it supports printing from command-line.
If currently associated program cannot programmatically
print its documents, then you will need to find (or write by
yourself) other program, which can do it.
HTH
Alex