Note that there are some explanatory texts on larger screens.

plurals
  1. POPrint spooler job cancellation message or callback wanted
    text
    copied!<p><strong>Backgroud:</strong><br> I'm now trying to print via <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff686799%28v=vs.85%29.aspx" rel="nofollow">GDI Print API</a>, and it looks like this:</p> <pre><code>StartDoc(hDC,&amp;docinfo) foreach page in page_buf StartPage(hDC) /* write the page to printer DC */ EndPage(hDC) EndDoc(hDC) </code></pre> <p><strong>The Problem:</strong><br> During printing there would be a notification area icon, and by clicking on it there would be a small window showing current printing jobs on a specified printer.<br> By right-clicking on a printing job and choosing <code>Cancel</code>, a printing job shall be cancelled. But my application continues sending data to the printer DC until all pages are processed, and the status keeps showing <code>Deleting - Spooling</code> before it finishes.<br> What I want is to stop the printing procedure right after choosing to cancel it.</p> <p><strong>What I've tried:</strong><br> 1. First I thought the device content would get invalid after cancelling the job (that's of course not true), and tried to examine the return values of <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd145116%28v=vs.85%29.aspx" rel="nofollow"><code>StartPage</code></a> and <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd162596%28v=vs.85%29.aspx" rel="nofollow"><code>EndPage</code></a>. Then I found they both don't fail after the cancellation of printing job.<br> 2. I've also tried <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd162960%28v=vs.85%29.aspx" rel="nofollow"><code>SetAbortProc</code></a> and <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd183575%28v=vs.85%29.aspx" rel="nofollow"><code>DocumentEvent</code></a>, and found they're not what I want.</p> <hr> <p>But I suppose there shall be some mechanism to indicate my application when the printing job is cancelled. It would be appreciated if someone tries to help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload