Is the printer ready ?


Author
Message
Charles R Hankey
Charles R Hankey
Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)Advanced StrataFrame User (922 reputation)
Group: Forum Members
Posts: 524, Visits: 30K
This sound like it should be easy but it isn't.  I need to find out from with a VFP app if a particular printer is ready to print. i.e it's current status  (Ready, out of paper, off-line whatever)  This code, offered up on  Universal Thread, doesn't work because if the printer is installed the handle will happen successfully (assuming the printer server box is on line) no matter what the status of the printer is.

(code below is a VFP function with syntax adjusted from VB)

LPARAMETERS tcprintername

&&#DEFINE cJobs_OFFSET 77

DECLARE INTEGER OpenPrinter IN winspool.drv;

STRING pPrinterName, INTEGER @phPrinter, INTEGER pDefault

DECLARE INTEGER ClosePrinter IN winspool.drv INTEGER hPrinter

cPrinter=tcprintername

hPrinter=0

IF OpenPrinter(m.cPrinter, @hPrinter, 0) = 0

&&? "Unable to obtain handle for the printer."

RETURN -1

ENDIF

= ClosePrinter(hPrinter)

RETURN 0

I found this http://www.merrioncomputing.com/Programming/PrintStatus.htm and I think my answer for creating a dll in .net may be in here but putting it together is a little beyound my current understanding of how these pieces fit.

Anyone who has solved this, knows of a third party dll that can be obtained or purchased, or who has already invented this wheel - you guidance will be greatly appreciated.

Charles

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Charles R Hankey - 16 Years Ago
Edhy Rijo - 16 Years Ago
Charles R Hankey - 16 Years Ago
Edhy Rijo - 16 Years Ago
Trent L. Taylor - 16 Years Ago
Edhy Rijo - 16 Years Ago
                         Add SYstem.Management as a reference.
Trent L. Taylor - 16 Years Ago
                             Thanks, that did it!
Edhy Rijo - 16 Years Ago
Charles R Hankey - 16 Years Ago
             Glad it helped! :)
Trent L. Taylor - 16 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search