Return value of CDialog::StaticDialogProc

  • erha

    erha - 2009-09-11

    Hi David,

    I am encountering some problem here.
    As the return value of CDialog::StaticDialogProc and its related function (DialogProc, DialogProcDefault etc) is BOOL, the return value set by the object (which inherit from CDialog) is not pass to the Windows object as it is cast to BOOL.

    Is there any reason why it is declare as BOOL instead of LRESULT?

  • David

    David - 2009-09-15


    The return value of CDialog::StaticDialogProc is BOOL because thats the way the Windows API handles message processing for dialogs.

    Here is a quote regarding the return value of DialogProc from the Windows API documentation:

    "Typically, the dialog box procedure should return TRUE if it processed the message, and FALSE if it did not. If the dialog box procedure returns FALSE, the dialog manager performs the default dialog operation in response to the message.

    If the dialog box procedure processes a message that requires a specific return value, the dialog box procedure should set the desired return value by calling SetWindowLong(hwndDlg, DWL_MSGRESULT, lResult) immediately before returning TRUE. Note that you must call SetWindowLong immediately before returning TRUE; doing so earlier may result in the DWL_MSGRESULT value being overwritten by a nested dialog box message."

    Best Regards,

  • erha

    erha - 2009-09-29

    Thanks for the info.

    Will try it….



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks