Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OpenPrinter
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
OpenPrinter
Miscellaneous
Thread ID:
00227946
Message ID:
00227946
Views:
69
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)
Next
Reply
Map
View

Click here to load this message in the networking platform