spool file name

C

Chtiot

Hello,


I'm not sure to be in the good forum, but i will ask my question :

- i'm using findfirstprinterchangenotification to know when something is
sent to a particular printer (no problem)
- when something is sent to this printer, i list the jobs with enumjobs (no
problem)

When a job is sent to this printer, i open the spool file an do some
operations on the file (generate a pdf, send an email ...).

I have no problem when the printer is a local printer with enhanced
functionalities not actived (the spool file name is equal to the idJob with
extension .spl -> 00027.spl for the job with idjob 27 found with enumjobs).

But when the printer in a network printer, the name of the spool file is
very different (FP + a number different od idJob found with enumjobs +
extension .spl -> for example, idJob = 27 -> spool file name is
FP004251.spl).

Is there a way to find the name of the spool file by programation, using an
api ?


thanks

Michel
 
P

Paul Baker [MVP, Windows - SDK]

It doesn't look like it is returned in any of the JOB_INFO_* structures
returned by EnumJobs or GetJob.

I see a GetSpoolFileHandle function added in Windows Vista:
http://msdn2.microsoft.com/en-us/library/aa964993.aspx

Perhaps you can pass this handle to GetFileInformationByHandleEx, also added
in Windows Vista:
http://msdn2.microsoft.com/en-us/library/aa364953.aspx

If it is a network printer, is the spool file on the print server?

Maybe this should be handled through a custom print processor or print
monitor?

Paul
 
C

Chtiot

thank you, i will try this

for the network printer, the spool in on the spool directory of the print
server
 
C

Chtiot

the GetFileInformationByHandleEx is exactly what i need, but it doesn't work
on windows xp...
 
P

Paul Baker [MVP, Windows - SDK]

Your welcome. So then your application would have to be running on the print
server in this case.

What do you think about making it a print processor or print monitor?

Paul
 
C

Chtiot

thank you

i don't know how to make a print processor or a print monitor (or i don't
understa,d your question, my english is bad, lol)

i juste want to intercept print job sent to a specific printer and open the
spool file to change some characters and, in function of what i find in the
file, sending an email or a fax.
 
P

Paul Baker [MVP, Windows - SDK]

Chtiot,

Yes. The print spooler is designed to be built from components that can be
substituted with third party solutions. That is the reason you will see many
posts on this newsgroup suggesting removing third party components if the
print spooler is acting unreliably as a first step. If you write a printing
component, you should do it right. But it will give you more of an
"internal" look at things and get the control you need.

I have not written a print processor or print monitor myself, and I am not
all that familiar with your application or the purpose behind it. Therefore,
I don't know which you should write. You could start reading here:

Spooler Component Functions and Structures
http://msdn2.microsoft.com/en-us/library/aa506753.aspx

You might benefit from a better understanding of the print components
involved. In fact, I can't say I have a great understanding myself. I did
not have time to find a good reference for you, but you can start on MSDN.

Paul

Chtiot said:
thank you

i don't know how to make a print processor or a print monitor (or i don't
understa,d your question, my english is bad, lol)

i juste want to intercept print job sent to a specific printer and open
the spool file to change some characters and, in function of what i find
in the file, sending an email or a fax.

Paul Baker said:
Your welcome. So then your application would have to be running on the
print server in this case.

What do you think about making it a print processor or print monitor?

Paul

Chtiot said:
thank you, i will try this

for the network printer, the spool in on the spool directory of the
print server

"Paul Baker [MVP, Windows - SDK]" <[email protected]> a
écrit dans le message de news: (e-mail address removed)...
It doesn't look like it is returned in any of the JOB_INFO_* structures
returned by EnumJobs or GetJob.

I see a GetSpoolFileHandle function added in Windows Vista:
http://msdn2.microsoft.com/en-us/library/aa964993.aspx

Perhaps you can pass this handle to GetFileInformationByHandleEx, also
added in Windows Vista:
http://msdn2.microsoft.com/en-us/library/aa364953.aspx

If it is a network printer, is the spool file on the print server?

Maybe this should be handled through a custom print processor or print
monitor?

Paul

Hello,


I'm not sure to be in the good forum, but i will ask my question :

- i'm using findfirstprinterchangenotification to know when something
is sent to a particular printer (no problem)
- when something is sent to this printer, i list the jobs with
enumjobs (no problem)

When a job is sent to this printer, i open the spool file an do some
operations on the file (generate a pdf, send an email ...).

I have no problem when the printer is a local printer with enhanced
functionalities not actived (the spool file name is equal to the idJob
with extension .spl -> 00027.spl for the job with idjob 27 found with
enumjobs).

But when the printer in a network printer, the name of the spool file
is very different (FP + a number different od idJob found with
enumjobs + extension .spl -> for example, idJob = 27 -> spool file
name is FP004251.spl).

Is there a way to find the name of the spool file by programation,
using an api ?


thanks

Michel
 
C

Chtiot

thank you very much, i will read this.

Paul Baker said:
Chtiot,

Yes. The print spooler is designed to be built from components that can be
substituted with third party solutions. That is the reason you will see
many posts on this newsgroup suggesting removing third party components if
the print spooler is acting unreliably as a first step. If you write a
printing component, you should do it right. But it will give you more of
an "internal" look at things and get the control you need.

I have not written a print processor or print monitor myself, and I am not
all that familiar with your application or the purpose behind it.
Therefore, I don't know which you should write. You could start reading
here:

Spooler Component Functions and Structures
http://msdn2.microsoft.com/en-us/library/aa506753.aspx

You might benefit from a better understanding of the print components
involved. In fact, I can't say I have a great understanding myself. I did
not have time to find a good reference for you, but you can start on MSDN.

Paul

Chtiot said:
thank you

i don't know how to make a print processor or a print monitor (or i don't
understa,d your question, my english is bad, lol)

i juste want to intercept print job sent to a specific printer and open
the spool file to change some characters and, in function of what i find
in the file, sending an email or a fax.

Paul Baker said:
Your welcome. So then your application would have to be running on the
print server in this case.

What do you think about making it a print processor or print monitor?

Paul

thank you, i will try this

for the network printer, the spool in on the spool directory of the
print server

"Paul Baker [MVP, Windows - SDK]" <[email protected]> a
écrit dans le message de news: (e-mail address removed)...
It doesn't look like it is returned in any of the JOB_INFO_*
structures returned by EnumJobs or GetJob.

I see a GetSpoolFileHandle function added in Windows Vista:
http://msdn2.microsoft.com/en-us/library/aa964993.aspx

Perhaps you can pass this handle to GetFileInformationByHandleEx, also
added in Windows Vista:
http://msdn2.microsoft.com/en-us/library/aa364953.aspx

If it is a network printer, is the spool file on the print server?

Maybe this should be handled through a custom print processor or print
monitor?

Paul

Hello,


I'm not sure to be in the good forum, but i will ask my question :

- i'm using findfirstprinterchangenotification to know when something
is sent to a particular printer (no problem)
- when something is sent to this printer, i list the jobs with
enumjobs (no problem)

When a job is sent to this printer, i open the spool file an do some
operations on the file (generate a pdf, send an email ...).

I have no problem when the printer is a local printer with enhanced
functionalities not actived (the spool file name is equal to the
idJob with extension .spl -> 00027.spl for the job with idjob 27
found with enumjobs).

But when the printer in a network printer, the name of the spool file
is very different (FP + a number different od idJob found with
enumjobs + extension .spl -> for example, idJob = 27 -> spool file
name is FP004251.spl).

Is there a way to find the name of the spool file by programation,
using an api ?


thanks

Michel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top