Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6: Checking for LPT port status
Message
 
À
04/01/2001 14:26:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00458542
Message ID:
00460594
Vues:
15
Jim,
I checked out the FOPEN in the Hacker's Guide to VFP6 and it says: "While it may be theoretically possible to open other DOS devices, such as "LPT1:" or "COM1:" with this command, results under Windows are less than 100 percent predictable (and get less predictable under Win98 and NT!)."
David

>>>David,
>>>
>>>Do you have any documentation for the printer?
>>>
>>>You might be able to open the port, send the appropriate escape code and read the response. I think you can still talk to directly to parallel and comm ports with the FoxPro low level file functions.
>>>
>>>Jim
>>>
>>All I need is a way to check that the cable is plugged in and the printer is on. If either one of those cases in not true then give me an error code/message. I am using MSCOMM.OCX to check the status of a comm port. I would like to have way to check the LPT port. It doesn't matter what printer.
>
>
>David,
>
>You might try to open the port with the printer on-line and see if you can read from the port or write to it.
>
>lnHandle = FOPEN('LPT1')
>IF lnHandle > 0 AND FERROR() = 0
>
>
> FRWRITE(lnhandle, CHR(27) + )
> lnError = FERROR()
>
> *-- might put code here to read a response using FREAD()
>
> IF lnError = 0
>
> FCLOSE(lnhandle)
>
>
> ELSE
>
> FCLOSE(lnhandle)
>
>
> ENDIF && lnError = 0
>
>
>ELSE
>
>
>
>ENDIF && lnHandle > 0 AND FERROR() = 0
>
>Keep in mind that low level file functions operate outside the realm of the error handler. You'll need to monitor each open, read, and write with FERROR() and respond accordingly.
>
>
>Jim
DLC
"Use the Right Tool for the Job!"
davidandcynthia@email.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform