Accessing printer properties (remaining paper count) programmatically

591 views Asked by At

I have a photo kiosk that does picture taking and printing. The kiosk starts automatically in the morning and shutdown at night using Windows' Schedule Task. Now I am trying to add an email alert to the kiosk system so that when the printer is running low on paper, an email will be sent out to notify the support person to put on a new paper roll. At the moment, I am using a hack that retrieve the remaining paper count from a printer utility by grabbing the text from the printer utility using AutoHotKey (see image for the printer utility, it's a 500kb single executable file). I've also checked with the printer supplier but they don't have any library that I could call programmatically.

Printer Utility with remaining paper count

What I want to know is if there's a way to retrieve the printer properties through common printing API under windows or any way to replicate the command sent from the utility by using USB Sniffer, I've tried sniffing the USB port where the printer is connected using USBSnoop and USBlyzer but couldn't figure yet how the command was called. Any ideas?

Update 1: Here's the autohotkey code that I used to grab the text from the window.

Run, "C:\Documents and Settings\Crescendo4\Desktop\HTools-3.9.3.exe",, Min
Sleep 400
ControlGetText, OutputVar, Static13, HTools  3.9.3
MsgBox, 4096,, %OutputVar%, 1
WinClose, HTools  3.9.3 

Update 2: Tried WinAPIOverride32 but it doesn't show any DLL call.

0

There are 0 answers