PDA

View Full Version : How to programmatically delete a job


DanC
July 11th 05, 10:26 PM
Can someone point me to an example of how you can programmatically delete a
specified print job?

Byte
July 13th 05, 07:28 PM
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?

Dieter
July 15th 05, 09:40 PM
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" > schrieb im Newsbeitrag
...
> 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?

Google