Sign in with
Sign up | Sign in
Your question

How to programmatically delete a job

Last response: in Windows XP
Share
Anonymous
July 11, 2005 6:26:22 PM

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?
July 13, 2005 3:28:04 PM

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?
Anonymous
July 16, 2005 2:40:55 AM

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?
!