Sign in to follow this  
BrickInTheWall

Returning from Dialog Proc (win32)

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
alright, thanks! My code has gotten pretty broken since I didn't really pay attention to this. If I have problems fixing it I'll come back, but I think I've got it now.

Share this post


Link to post
Share on other sites

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