setjob (winspool)
Last changed: -83.244.229.222

.
Summary
TODO - a short description

C# Signature:

[DllImport("winspool.drv", EntryPoint="SetJob")]
public static extern int SetJobA(int hPrinter, int JobId, int Level, ref byte pJob, int Command_Renamed);

VB Signature:

User-Defined Types:

    public struct Printer_Defaults
        {
            public int pDatatype;
            public int pDevMode;
            public int DesiredAccess;
        }

        private enum Job_Control
        {
            Pause = 1,
            Resume = 2,
            Cancel = 3,
            Restart = 4,
            Delete = 5
        }

Notes:

Tips & Tricks:

How to cancel a print job:

int pHandle = 0;

Printer_Defaults defaults = new Printer_Defaults();

byte b = 0;

OpenPrinterA(printerName, ref pHandle, ref defaults);

SetJobA(pHandle, (int)jobID, 0, ref b, (int)Job_Control.Cancel);

ClosePrinter(pHandle);

Sample Code:

Please add some!

Alternative Managed API:

The System.Management API allows for lots of printer stuff, but doesn't let you delete a print job in Win2K.

Documentation
SetJob on MSDN