|
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);
}
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
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
|