Jump to content
  • Advertisement
Sign in to follow this  
BrickInTheWall

Returning from Dialog Proc (win32)

This topic is 2994 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!