Cancel Dialog Box

The Cancel dialog box typically contains a single push button that allows the user to cancel a print job. The following template for the Cancel dialog box was taken from the sample application's resource (.RES) file.

AbortDlg DIALOG LOADONCALL MOVEABLE DISCARDABLE 33, 32, 160, 70

CAPTION "Sample Printing App"

STYLE WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_VISIBLE |

WS_POPUP | WS_SYSMENU

BEGIN

CONTROL "Now Printing: ", IDD_TEXT, "static",

SS_CENTER | WS_CHILD, 0, 10, 160, 8

CONTROL "", IDD_FILE, "static",

SS_CENTER | WS_CHILD, 0, 25, 160, 8

CONTROL "Cancel", IDD_CANCEL, "button",

BS_DEFPUSHBUTTON | WS_TABSTOP | WS_CHILD,

60, 45, 45, 15

END

The code sample that follows shows the dialog box procedure for the application.

LRESULT CALLBACK AbortPrintJob(

HWND hwndDlg, /* window handle of dialog box */

UINT message, /* type of message */

WPARAM wParam, /* message-specific information */

LPARAM lParam) /* message-specific information */

{

switch (message) {

case WM_INITDIALOG: /* message: initialize dialog box */

/* Initialize the static text control. */

SetDlgItemText(hwndDlg, IDD_FILE, ofn.lpstrFile);

return TRUE;

case WM_COMMAND: /* message: received a command */

/* User pressed "Cancel" button--stop print job. */

MessageBox(hwndDlg, "Incoming", "WM_COMMAND", MB_OK);

bPrint = FALSE;

return TRUE;

default:

return FALSE; /* didn't process a message */

}

UNREFERENCED_PARAMETER(lParam);

UNREFERENCED_PARAMETER(wParam);

UNREFERENCED_PARAMETER(message);

}

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database