Sign in to follow this  

Returning from Dialog Proc (win32)

This topic is 2782 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have a question about when and how to return from a dialog procedure. I have a pretty big dialog box that does a lot of stuff and quite frankly I'm getting confused. I have sections like this for example:
switch (msg)
{
    case WM_COMMAND:
    {
        switch (LOWORD(wParam))
        {
            case ID_EDITMANP_LB:
            {
                switch (HIWORD(wParam))
                {
                    case LBN_SELCHANGE:
                    {
                        int i = 0;
                  ...
                  ... 
                  ...

I'm simply unsure now when to return TRUE and when to return FALSE. Do I return TRUE if I process WM_COMMAND, but none of the cases of the LOWORD of wParam match? Do I generally return TRUE when I'm in a case like ID_EDITMANP_LB in the example above? Cheers, Brick

Share this post


Link to post
Share on other sites
Return FALSE when you want default processing.

If LOWORD(wParam) of WM_COMMAND doesn't equal the id of any control that your code created then you definitely want default processing so return FALSE.

If LOWORD(wParam) of WM_COMMAND equals ID_EDITMANP_LB, which I assume is a list box you created, return TRUE if it's actually a notification you care about and in fact handle -- e.g. say, your app cares about LBN_SELCHANGE, handle it and return TRUE -- otherwise, return FALSE.

Share this post


Link to post
Share on other sites

This topic is 2782 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this