mfc >> HELP Needed: AddJob function not working from XP desktop

by Stewart Peck » Wed, 26 Nov 2003 05:31:41 GMT

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.




Similar Threads

1. AddJob function for printing (XP not working)

2. Need help with Drag-and-drop works for muilti rows but not single

Hi, I'm using vs2005, .net 2 for a window application.  My datagridvew was 
working before when I drag just one item to another datagridvew.  I modified 
the code to do multiple rows draging.  Now when I drag multiple rows it works 
but when I drag one row I get this circle and a diagnoal line in it, I think 
that's a "No" sign, when I'm draging to the target grid.  When I release the 
mouse button then nothing happen.  
I track this to the Datagridview_MouseMove event where the DragDropEffects 
variable is alway returned as null when I drag just one item:

DataRowView view = (DataRowView) dgv.Rows[info.RowIndex.DataBoundItem];
dragDroip = dgv.DoDragDrop(view, DragDropEffects.All);

Does anyone know what could be cuasing this?  Thanks.
-- 
Thanks.

3. [HELP NEEDED] Some IOCTL do not work on KernelIoControl for Asus A716 - Windows CE

4. [URGENT NEED HELP] ASUS A716 KernelIoControl not working for some IOCTL

Hello,

I want to get some unique number for the PPC. For all HP and Acer PPC
running PPC2003 or above, I have no problem in getting the SD card
serial number by
KernelIoControl(IOCTL_DISK_GET_STORAGEID,......)

However, it does not work for Asus A716 (which is a PPC2003), it
return FALSE when executing
KernelIoControl(IOCTL_DISK_GET_STORAGEID,......)

What is even worst is I also get a FALSE (i.e. failure) when executing
the folloing IOCTL
KernelIoControl(IOCTL_HAL_GET_UUID,......)
KernelIoControl(IOCTL_HAL_GET_DEVICEID,......)

Are there any people having similar problems and how to solve this
problem? Many many many thanks in advance.

Best regards,
John. ( XXXX@XXXXX.COM )

5. Help needed getting "dl"-functions to work in Win32

6. AddJob function for printing

I'm trying to find a sample. This is another function that is not working
the same on an XP machine.


7. GetCursorPos not working if desktop is locked - CSharp/C#

8. Desktop Icon not working on windows 7

Hi All,

I have created a desktop icon using ATL\COM. I added drag drop
functionality to it. This application works fine on XP and Vista but
fails on Win7. On Win7 the icon gets created on the desktop but when i
drag a file or folder to it, the icon is not highlighted and does not
accept the file\folder.

I have implemented the IShellFolder, IPersistFolder and IDropTarget
interfaces. The issue is that IShellFolder::CreateViewObject is not
getting called on Win7.

Can anyone tell why is this happening on Win7? Am i missing something?

Regards,
Rohit