Archived

This topic is now archived and is closed to further replies.

Scint

Dialog Box Button Problems

Recommended Posts

I''m working on a program with a dialog box but I can''t seem to get the button to do what they are supposed to do. What I want: 4 Buttons: OK, Cancel, Readme, About OK -- goes to next step Cancel -- ends program Readme -- opens another dialog box with info on how the program works About -- Made by ... 2004, Version 1.00 In the resource editor I put down the buttons. Respectively, the button''s ID are IDOK, IDCANCEL, IDC_BUTTON1, IDC_BUTTON2. In the dialog''s callback, IDOK and IDCANCEL work just fine and do what they are supposed to when I click on the button. However, with the IDC_BUTTON1 and 2 I need to do a #define line at the top of the file. Okay... I decide to set the defines as such: #define IDC_BUTTON1 1001 #define IDC_BUTTON2 1002 My problem is, I can never get both buttons to work, and I get strange behavior by doing things that I think shouldn''t matter, such as changing the order of the #defines or the cases in the callback or even where the button is placed on the dialog box. When I swap the #defines, the callback''s switch statement will choose the wrong case. I think the solution has something to do with the numbers in the defines, but I don''t really know what they mean since I learned this from examining sample code. Can anybody explain what''s going on with using dialog box buttons?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Include "resource.h" instead of defining the control ids yourself.

Share this post


Link to post
Share on other sites
When you create the buttons in the resource editor, the editor automatically assigns values for them and #define''s them in resource.h. You should be #include''ing resource.h in your source file.

Share this post


Link to post
Share on other sites