IPrintDialogCallback::HandleMessage

[This is preliminary documentation and subject to change.]

The PrintDlgEx function calls the HandleMessage method to give your application an opportunity to handle messages sent to the child dialog box in the lower portion of the General page of the Print property sheet. The child dialog box contains controls similar to those of the Print dialog box.

HRESULT HandleMessage(
  HWND hDlg,
  UINT uMsg,
  WPARAM wParam,
  LPARAM lParam,
  LRESULT *pResult
);
 

Parameters

hDlg
Handle to the child dialog box in the lower portion of the General page.
uMsg
Identifies the message being received.
wParam
Specifies additional information about the message. The exact meaning depends on the value of the uMsg parameter.
lParam
Specifies additional information about the message. The exact meaning depends on the value of the uMsg parameter.

If the uMsg parameter indicates the WM_INITDIALOG message, lParam is a pointer to a PRINTDLGEX structure containing the values specified when the property sheet was created.

pResult
Pointer to a variable that you should set to indicate the result to be returned by the dialog box for the message.

Return Values

Return S_OK if your HandleMessage implementation handled the message. In this case, the PrintDlgEx function does not perform any default message handling.

Return S_FALSE if you want PrintDlgEx to perform its default message handling.

Remarks

For notification messages passed by the WM_NOTIFY message, you must use the SetWindowLong function with the DWL_MSGRESULT value to set a return value. When you call SetWindowLong, use GetParent(hDlg) to set the DWL_MSGRESULT value of the General page, which is the parent of the child window.

The default dialog box procedure for the child window in the lower portion of the General page processes the WM_INITDIALOG message before passing it to the HandleMessage method. For all other messages sent to the child window, HandleMessage receives the message first. Then the HandleMessage return value determines whether the default dialog procedure processes the message or ignores it.

If HandleMessage processes the WM_CTLCOLORDLG message, it must return a valid brush handle for painting the background of the dialog box. In general, if HandleMessage processes any WM_CTLCOLOR* message, it must return a valid brush handle for painting the background of the specified control.

Do not call the EndDialog function from the HandleMessage method. Instead, HandleMessage can call the PostMessage function to post a WM_COMMAND message with the IDABORT value to the dialog box procedure. Posting IDABORT closes the Print property sheet and causes PrintDlgEx to return PD_RESULT_CANCEL in the dwResultAction member of the PRINTDLGEX structure. If you need to know why HandleMessage closed the dialog box, you must provide your own communication mechanism between the HandleMessage method and your application.

You can subclass the standard controls of the child dialog box in the lower portion of the General page. These standard controls are similar to those found in the Print dialog box. However, the default dialog box procedure may also subclass the controls. Because of this, you should subclass controls when HandleMessage processes the WM_INITDIALOG message. This ensures that your subclass procedure receives control-specific messages before the subclass procedure set by the dialog box procedure.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in commdlg.h.

See Also

Common Dialog Box Library Overview, IPrintDialogCallback, EndDialog, PostMessage, PrintDlgEx, PRINTDLGEX, SetWindowLong, WM_COMMAND, WM_CTLCOLORDLG, WM_INITDIALOG, WM_NOTIFY