How to programmatically delete a job

Archived from groups: microsoft.public.windowsxp.print_fax (More info?)

Can someone point me to an example of how you can programmatically delete a
specified print job?
2 answers Last reply
More about programmatically delete
  1. Archived from groups: microsoft.public.windowsxp.print_fax (More info?)

    Start>Control Panel>Printers and Faxes>doubleclick your printer>
    If you want all printing to stop, click Printer and then click "cancel all
    documents", or within that window, highlight the specific job and
    click Document and click Cancel.
    --
    Some days you're the windshield,
    some days you're the bug.


    "DanC" wrote:

    > Can someone point me to an example of how you can programmatically delete a
    > specified print job?
  2. Archived from groups: microsoft.public.windowsxp.print_fax (More info?)

    Hi Dan,

    try this

    Dieter

    // Delete Job with Id nJobId

    OSVERSIONINFO osInfo;
    BOOL bResult;
    HANDLE hPrinter = NULL;

    if (!OpenPrinter (pPrinterName, &hPrinter, NULL))
    {
    ...
    }
    ZeroMemory (&osInfo, sizeof (OSVERSIONINFO));
    osInfo.dwOSVersionInfoSize = sizeof ( OSVERSIONINFO);

    GetVersionEx (&osInfo);

    if (osInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ||
    osInfo.dwMajorVersion < 4)
    {
    // Windows 95/98/Me, Windows NT 3.51 and earlier
    bResult = SetJob (hPrinter, nJobId, 0, NULL, JOB_CONTROL_CANCEL);
    }
    else
    {
    // Windows NT4.0 and later
    bResult = SetJob (hPrinter, nJobId, 0, NULL, JOB_CONTROL_DELETE);
    }
    if (hPrinter)
    {
    ClosePrinter (hPrinter);
    hPrinter = NULL;
    }


    "Byte" <Byte@discussions.microsoft.com> schrieb im Newsbeitrag
    news:081BD650-AB4A-4509-9E2C-FCD095F93F4D@microsoft.com...
    > Start>Control Panel>Printers and Faxes>doubleclick your printer>
    > If you want all printing to stop, click Printer and then click "cancel all
    > documents", or within that window, highlight the specific job and
    > click Document and click Cancel.
    > --
    > Some days you're the windshield,
    > some days you're the bug.
    >
    >
    > "DanC" wrote:
    >
    >> Can someone point me to an example of how you can programmatically delete
    >> a
    >> specified print job?
Ask a new question

Read More

Microsoft Windows XP