Printing Problem!!!

vspvajja used Ask the Experts™
Hi All,

I am working on a print server application which create word documents on the fly and sends them to the printer. My problem is, how do i know if the document is printed or not. How can i get a response from the printer back to my application (VB App). Is there any way to do this??

Thanks in advance,
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Here are the Windows API calls for Spool management:

But there is a simple way using ShellExecute function.

If Not PrintOK Then
    App.LogEvent "Could not print...etc.

End if
here is the code for the function:

Private Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _
        (ByVal hwnd As Long, ByVal lpOperation As String, _
        ByVal lpFile As String, ByVal lpParameters As String, _
        ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Function LaunchOK(FileName As String, Optional Params As String = "", Optional OpenMode As String = "Open")

Dim lr As Long
Dim folder As String

folder = FolderName(FileName)
If Right(folder, 1) = ":" Then
    folder = folder + "\"
End If

lr = ShellExecute(0, OpenMode, FileName, Params$, folder$, vbNormalFocus)
If (lr < 0) Or (lr > 32) Then
    LaunchOK = True
    LaunchOK = False
End If

End Function


Hi inthedark,

Thanks for the response. I think this only solves half of my problem. Sorry if i was not very clear in my question.

I am writing a print server which will be printing hundreds (possibly thousands) of word documents on the fly. I know this is not possible in one go and cannot complete without any problems. If by chance, any document is not printed (which will be the case considering my programming skills) i need to make note of it, so that my app can come back to it later...


I am looking for some way (i may be stupid!!) for the printer to respond to the application saying "Yes i printed that!!" or "Nope...could'nt print because blah blah blah....".

The function you sent me only takes care of the pre-print process. Once the control is transfered to the printer, it forgets about the document.

I am worried specially of this period (if the paper runs out, printer gets blown up, etc...) Is there is any way to get the response back from the printer???? (tell me if iam being stupid and if this is not possible).

It is possible to check the printer status, I created a bit of code that by passes the windows spooler and uses a Dos interrupt to directly look at the LPTx port.

So the best way is to save the print until the printer status is OK.

What OS are you using, because pre windows 2000 you could not have more than 100 documents spooled.  

Also you can view the printer spool queue. and the NT Event logs.


I am using windows 2000 OS at the moment.
Author of the Year 2009

Hi vspvajja,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept inthedark's comment(s) as an answer.

vspvajja, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept THIS comment as an answer.
DanRollins -- EE database cleanup volunteer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial