Information générale
Catégorie:
Fonctions Windows API
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement