You can check if the printer is on the network, but only if you have access to kernel mode, if you are a print driver or under Windows 95/98.
Typically, the printer port address is set to 0x378 (parallel port data register). Adding one ( 0x379 ) to this gives us the address of the parallel port status register. bit 4 of the Status Register (SELECT) indicates whether the printer is online or offline. if the bit is set, then the printer is connected to the network and if its 0, the bit is disabled. It might look like this:
int status; // get status register value at 0x379 status = _inp (0x379); if (status & 0x10) // check bit 4 { // printer online } else { // printer offline }
Here is another member of this register:
bit 1 : DCN bit 3 : FAULT bit 4 : SELECT bit 5 : PAPER END bit 6 : ACKNOWLEDGE bit 7 : BUSY
It comes from codeguru . But note that it is better to use a higher interface like api printer in WIN32 (OpenPrinter (), WritePrinter () StarDocPrinter (), StartPagePrinter (), etc.)
Coren source share