Link to home
Start Free TrialLog in
Avatar of davvan
davvan

asked on

how do I know if the printer is printing?

can I, through VB, see if the printer currently is printing, and how many pages that have been printed out? thanx in advance!
ASKER CERTIFIED SOLUTION
Avatar of y96andha
y96andha

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of davvan
davvan

ASKER

Thanx for the great and fast answer! But as I understand, this is VB4-code, and I would like to write the program in VB3. Do you know a way do do this?
This is VB5 code, but it should work in VB4 32-bit. It doesn't work in 16-bit anyway though.

I do not think that the 16-bit printer handling can access the number of pages printed. If you print yourself, you could perhaps make each page a different document? I don't have any 16-bit VB installed myself, so I am afraid I can't test it.

What operating system will you be using? It might be possible to check for the files of the print spooler to see when a job has finished printing.

Avatar of davvan

ASKER

I'll most use Windows NT, so I better write a 32-bit program ;-)
It should be great if the code worked on Windows 3.1x, but it doesn't matter.

Do you know if I can 'check for the files of the print spooler' in Windows NT?
In Windows NT, print jobs consist of two files stored in the %SystemRoot%\system32\spool\printers directory. It would be possible to check if the job has finished printing by checking for these files.

But if you do not need the 16-bit environment, I really would suggest moving to VB5. I know that VB4 is much slower than VB3, but VB5 is much faster than VB4, and little faster than VB3. And you could access all new functions.
Avatar of davvan

ASKER

I saw in your user profile that you are from Sweden? Is that correct? I live in Gothenburg myself!
Right now, I only own the VB4 and I don't think I can afford to buy VB5, but I'll think about it.
Thanx about the tip of the printers directory. I'll check it out!
Sure, I am from Linkoping. I bought VB4 and MSVC++ 4.0 on student license in January for about 1000kr. A few months later I received free copies of VB5 and MSVC++ 5.0, as a free upgrade because they had been released when I bought the older versions.

What kind of program are you writing? VB4 32-bit isn't that bad on a fast computer.
Avatar of davvan

ASKER

We've got a small network with 5 users in it, and I am writing a program which logs how many pages each user are printing out. And thanx to you, I'm almost finished! Thank you a lot for helping me out!

We've got Pentium 133, so I think that's enough for VB4 32-bit
Suggestion: You could use event logging, and read the log so you don't have to keep your program running and checking the printer at all times. But it shouldn't be such a big performance issue anyway.
Avatar of davvan

ASKER

thanx for the great help you've been to me!
just one little questrion:
can I, through the log, see how many pages each user has printed out?
If you use NT Workstation and enable logging, I think so. And I am sure that you can if you are using NT Server. Of course this only works if the print job comes from a 32-bit client, as 16-bit clients don't pass information on the number of pages for a print job.