I have an application that has been running for many years. It uses AddJob
to send an ai file to the printer. Now we are starting to put some XP
machines on our desktops and the print functions are not working.
My code calls AddJob with Null as the buffer. The return value in cbNeeded
tells me how large the buffer should be. So then, I create the buffer and
call AddJob again accordingly. This works fine under other operating
systems.... 95, 98, etc....
With XP, I'm getting error 1784: The supplied user buffer is not valid for
the
requested operation.
code is similar to:
BYTE* bBuf = NULL;
cbBuf = sizeof(ADDJOB_INFO_1);
bRet = AddJob(hPrinter, 1L, bBuf, cbBuf, &cbNeeded);
if ( !bRet )
{
error = GetLastError();
...... etc
bRet is zero value and
cbNeeded is returning the value of zero.
The next step would be to call AddJob again with bBuf set to whatever
cbNeeded established but the zero value triggers an 87, parameter is
incorrect, error.
I suspect the 1784 is the culprit but cannot find a reason for the buffer to
be invalid.
I've also tried initializing bBuf to point to a small buffer but no good on
that one either. It returns an 87 error also.
I can not find any samples on MSN for AddJob; if someone has one or can
point me in the direction of one, I would appreciate it.
Thanks for your time.