Hello everybody (again)
As I wrote in a former topic, I access the parallel port (only in output mode) via the Win API using Delphi 6, i.e. via CreateFile, WriteFile and CloseHandle. I made the connections described by "John Sawyer" directly on the DB25 male connector in order to simulate the handshaking of a printer, it works fine under W2K and XP.
Now I want to detect if the device is plugged in, otherwise there is a popup after about 1mn 45s, indicating a Write Error to the printer (which does not exist really, even if the device is plugged in). Testing the handle's value does not give the expected result ; GetLastError and IOResult after a Write operation seem to crash (freeze) the program if the device is not plugged in.
I believe that there is an API call to test if the printer is busy, not selected or out of paper (the corresponding pins are tied to GND via the connector), without reading the registers (that operation should need a driver like InpOut32.dll) , just after the CreateFile, so I could close the handle without any write operation , beep and quit the application. Does anyone have an idea ?
Thanks for any information