Article View: comp.lang.basic.visual.3rdparty
Article #22Re: VB5 Check if Printer is Online
From: Giles Thurston
Date: Fri, 09 Apr 1999 00:00
Date: Fri, 09 Apr 1999 00:00
56 lines
3671 bytes
3671 bytes
Cheers for the response JC. At least I now know that its not just me being stupid. I spend many a brain draining hour trawling through API books etc. I called MS and the solutions they gave me didn't work. Eventually after playing around with MS solutions I was able to get a workable solution. I used the enumJobs API call to monitor the status of the first job in the Printer Queue. When the dialog box is displayed by Windows saying "There is a problem with you printer etc" the status of the Job changes to a new value. By detecting this change I was able to remove Printing Job from the Printer Queue using another API (SetJob I think!). This allows you to detect the majority of problems with a printer with the exception of one. If a printer is physically turned off Windows (95 anyway!) doesn't seem to care! Windows appears to place a job in the Printer Queue and then delete it immediately with no change in state and no error reported. Even if you print a document from Word to a Printer which is off you get the same Error. The response from MS on this was ".. well if Word doesn't catch it you probably won't be able to.." Anyway that in a nutshell is my solution. Feel free to contact me for further details. Any better solutions would be gratefully received regards GilesT@mentor.co.uk JC wrote in message <370D67DE.E3905845@home.com>... >I missed the first part of this thread, but I have been trying to get to >the printer ports (parallel) myself for some time, and they are getting >harder and harder to get to. > >I work with a multi-user Point of Sale system, and we need to be able to >detect problems with printers automatically and re-route the printout to >another printer when there is a problem. I managed to do this by >building my own spooler for serial printers, but with the print manager >taking over things, I cannot get to the parallel printers. Printing a >line at a time to LPT1 is not even supported in NT anymore, so that's >out. > >Yeah, I spent a few days with those API's, but never found one that >could tell (from VB, mind you) that the printer jammed, or went off-line >in the middle of a printout, then let me handle things by re-routing to >the next printer on my user's pre-defined list. Some crusty old >seasoned programmers have told me that it is impossible. > >I have no words of wisdom, but you do have my sympathy - and please do >let me (or the group) know if you find something handy.... > >JC
Technical Details
Message-ID:
<7elc38$k4n$1@mendelevium.btinternet.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7e073e$t3e$1@uranium.btinternet.com> <8D9C9305Fckincaidatkcdotnet@msnews.microsoft.com> <7ecej0$eeu$1@plutonium.btinternet.com> <370D67DE.E3905845@home.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 110e3b,c60f5e217257965a X-Google-Attributes: gid110e3b,public X-Google-Thread: 1143a7,c60f5e217257965a X-Google-Attributes: gid1143a7,public X-Google-Thread: fb992,c60f5e217257965a X-Google-Attributes: gidfb992,public X-Google-Thread: 100d42,c60f5e217257965a X-Google-Attributes: gid100d42,public X-Google-Thread: f5f6f,c60f5e217257965a X-Google-Attributes: gidf5f6f,public X-Google-Thread: 108062,c60f5e217257965a X-Google-Attributes: gid108062,public From: "Giles Thurston" <GilesT@mentor.co.uk> Subject: Re: VB5 Check if Printer is Online Date: 1999/04/09 Message-ID: <7elc38$k4n$1@mendelevium.btinternet.com> X-Deja-AN: 464493501 References: <7e073e$t3e$1@uranium.btinternet.com> <8D9C9305Fckincaidatkcdotnet@msnews.microsoft.com> <7ecej0$eeu$1@plutonium.btinternet.com> <370D67DE.E3905845@home.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: BT Internet Newsgroups: comp.lang.basic.visual.3rdparty,comp.lang.basic.visual.database,comp.lang.basic.visual.misc,comp.lang.visual.basic,cz.comp.lang.basic.visual,microsoft.public.basic.other