Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OpenPrinter
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
OpenPrinter
Divers
Thread ID:
00227946
Message ID:
00227946
Vues:
70
In printer properties there is a setting that indicates if the print job should spool before printing or go directly to the printer. I need to change this programmatically and couldn’t find anything in VFP to do it, so I resorted to the API which has the SetPrinter function which should do what I want. However before calling SetPrinter I must use OpenPrinter which requires a pointer to a structure as a parameter. I can’t get it to work under VFP(Openprinter allways returns 0) Has somebody had experience with this before that cares to offer some suggestions on what to try.

Here is my current attempt…

Declare Integer HeapCreate in win32Api;
integer, integer,integer

Declare Integer HeapAlloc in win32Api;
integer, integer,integer

Declare INTEGER OpenPrinter IN winspool.drv AS OpenPrinter;
STRING pPrinterName , ;
INTEGER phPrinter,;
INTEGER pDefault

Declare INTEGER SetPrinter IN winspool.drv;
INTEGER hPrinter ,;
INTEGER Level,;
INTEGER pPrinter


Public lnpoint, lnarray,cbBuf,pcbNeeded,pd
lnpoint=0

lnHeap=HeapCreate(0,4,0)
lnalloc=HeapAlloc(lnHeap,0,4)

lnhandle=OpenPrinter('\\myserver\myprinter', lnpoint, lnalloc)
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform