How to send a .bmp file to a specific printer from a NT service runnin on a NT server (nt4sp6a)
Posted on 2003-03-25
The problem is that I have this server ruiing a service which is responsible
for downloading weather data from various ftp sites at specific intervals.
Some weather products I would like to print automatically as soon as they are
I tried this:
winexec ("mspaint /p filename.bmp")
This is somewhat of a patch of course...
Now what I want to do is to be able to specify that for this of that product
you will print on that printer...
I have 2 problems whit this:
1) how to specify the printer I want to use? This is a nt service so I can't pop
up a printer dialog and let a user pick a printer... It all have to be done
via programmation and I don't know how to get the list of printer for instance...
2) how to send the file to the printer? Since this is a nt service I need to
somehow package the .bmp file before printing it? How do I go about doing this?
I really would like to bypass sending the file to mspaint because I'd have to
alter the default printer each time BEFORE calling mspaint /p (on the server
this might be annoying because the admin will have to check each time what's
his default printer!)... Do I have to built a special .exe file that will
receive the file name as a parameter and perform the encapsulation and printer
selection and handle the file printing??? This might be the cleaner way to do it?
Any hints/sugestions welcome ;-)