Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking LPT1 printer online
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00308803
Message ID:
00309108
Vues:
28
>I have a POS printer connect to LPT1 port in Win 98, VFP 5
>
>Under spool settings,
>
>[x] Print directly to the printer is selected
>
>Before allowing user to enter a card transaction, I need
>to know if the printer is online and ready.
>However, under vfp printstatus() will not work.
>
>How to check printer ready status ( some bits in
>lpt printer status port) from VFP ?

Hi Andrus,

This has been discussed here a number of time, with the conclusion always being that you can't determine the printer status beforehand in the Windows environment.

SYS(13) will always return "READY" and PRINTSTATUS() will always return .T. I write a DLL to see if it was possible to grab the actual status by calling the function GetPrinter() in the API and having it populate a PRINTER_INFO_2 structure. One of the members of this structure is called Status and from the description in the SDK would appear to be exactly what's required. However, while other members of this structure are populated by the call, this one isn't.

In experimenting with the functions, I found that Windows can "open" a printer (a required step) that is turned off and return information about it. While I don't know this for certain (and thus this is a SWAG), but I believe what's happening here is that if the spooler is not active, the available information is gathered from the registry (under HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers\< Printer Name >).

In the Windows environment, it's the operating system itself that's responsible for managing printing tasks and not the application. That being the case, the application knows very little about this sort of thing.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform