|
Abort Procedure
Any application written for Windows that supports printing should provide an
abort procedure and a modeless dialog box that allow a user to cancel a print
job. The abort procedure for the sample application contains a message loop that
retrieves messages for the modeless dialog box.
BOOL CALLBACK AbortProc(HDC hdc, int nCode)
{
MSG msg;
/*
* Retrieve and remove messages from the thread's message
* queue.
*/
while (PeekMessage((LPMSG) &msg, (HWND) NULL,
0, 0, PM_REMOVE)) {
/* Process any messages for the Cancel dialog box. */
if (!IsDialogMessage(hdlgCancel, (LPMSG) &msg)) {
TranslateMessage((LPMSG) &msg);
DispatchMessage((LPMSG) &msg);
}
}
/*
* Return the global bPrint flag (which is set to FALSE
* if the user presses the Cancel button).
*/
return bPrint;
}
For Win16-based applications, this procedure must be exported in the
application's module-definition (.DEF) file.
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps
Win32 Multimedia Programmer's Reference (mmedia.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|