IPrintOemPS2::WritePrinter invalid printer handle

IPrintOemPS2::WritePrinter invalid printer handle

Post by pscriptde » Fri, 21 Oct 2005 18:08:25


I've customized a pscript driver and implemented the
IPrintOemPS2::WritePrinter method. From there, I collect postscript
data, process it and then call the spooler's WritePrinter API as
follows:

if(::WritePrinter(pdevobj->hPrinter,pBuf,cbBuffer,pcbWritten) == FALSE)
{
// error processing
}
else
{
// normal case
}
The problem is that the spooler's WritePrinter call above always fails
with system error ERROR_INVALID_HANDLE.

So, where's is the error and which handle should I use?
 
 
 

IPrintOemPS2::WritePrinter invalid printer handle

Post by U2NvdHQgUm » Sat, 22 Oct 2005 02:31:05

Do you have a pointer somewhere to a IPrintOemDriverPS object somewhere?
It has a member DrvWriteSpoolBuf which could be helpful.

--
ScottR
Scott Robins

 
 
 

IPrintOemPS2::WritePrinter invalid printer handle

Post by pscriptde » Fri, 28 Oct 2005 16:39:03

OK, found the solution thanks Ivan Dimotrov who a similar problem
posted in the video group. I was linking against the spoolss.lib
library file (that also contains the WritePrinter API), whereas the
correct link was with the winspool.lib library.