onggie80 Posted January 27, 2004 Posted January 27, 2004 Hi, I need help in trying to check whether a printer is connected to the PC before sending my print job. Currently, when my C# application sends a print job, the windows print spooler will just accept it regardless of whether the printer is actually connected to the PC or not. (Pls note: the printer is a parallel port printer) I've tried using WMI (Win32_Printer, Win32_PrintJob) to get the status, however they don't reflect the "real" status of the printer or the print job. I am aware that there is Win API functions to send the print data directly to the printer, however, in my case, I'm using a Crysal Report Print Function which combines my .rpt, .xml and .xsd files before sending the print job to the printer. Thanks for all help! Quote
*Experts* Nerseus Posted January 27, 2004 *Experts* Posted January 27, 2004 Can you use something as simple as Printer.IsValid()? -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
onggie80 Posted January 28, 2004 Author Posted January 28, 2004 I haven't tried that yet. Not too sure if there is this method in C#, but shall try it out! :) Thanks... Quote
*Experts* Nerseus Posted January 28, 2004 *Experts* Posted January 28, 2004 It's a static method on the Printer object, part of the framework. I use it to verify that a string ("\\server\printer name") is a valid printer name before I pass it onto some 3rd party software. I get the strings from a database table and you can't ever trust your users to cut and paste things right :) I know it works to locate a printer, but I don't think it will give you any kind of status. I also don't know of any way to determine if the printer is locally connected or not. I would guess you could, just never had the need. -nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.