Re: Delphi printer ready and int $17??
Posted by webmaster Guido on January 08, 2004 at 16:20:04:
In Reply to: Delphi: printer ready and int $17? posted by Sheirly Dewi on December 23, 2003 at 05:54:30:
: How to detect in my Delphi app whether the printer power is ON or OFF and how to detect
the paper of printer is ready? I use Borland Delphi 7 and Windows 2000.
: function PrinterStatus : integer;
The problem with this code is that it doesn't work under Windows NT, and probably also not under Win2000 and Windows XP: it gives an access violation from the DOS interrupt call "int 17h".
Printing is normally done using Windows' "Spooler" system. The whole point of Windows' print system is to isolate the programmer from the many different types of printers and interface cards out there. That's why more secure OS's (such as Win2000, NT, Windows XP) will not like it when you directly access a printer port.
However, for some old systems, direct access to a printer may be the only way to accomplish certain things. Only in that case use the code with "int 17h".
[ DelphiLand: free Delphi source code, tips, tutorials ]