-1

I am working with C++ Builder and I want to work with MessageBox and the clickables "OK" and "Help". When the user presses "Help", a new form should be opened. So here is my problem:

While using MessageBox and the command with MB_HELP, the Buttons "ok" and "Help" will be displayed. But when pressing Help the compiler won't do anything, he only does something and returns 1 when i am pressing Ok Button.

btw. i am with VCL-Formapplication.

Thanks for your help :)

if (Application->MessageBox("Die maximale Temperatur von 30°Grad darf nicht 
überschritten werden",
    "Warnung", MB_HELP | MB_ICONEXCLAMATION) == IDOK);
         {
            ///setting values///
         }           
else Form1->Show();   
alexander.polomodov
  • 5,396
  • 14
  • 39
  • 46
kevin
  • 71
  • 1
  • 8

1 Answers1

1

I think I get it now.

If you want to check several conditions on the same result, you can assign it to a variable first. MessageBox returns an int, so:

int choice = Application->MessageBox("Die maximale Temperatur von 30°Grad darf nicht überschritten werden",
                                     "Warnung", MB_HELP | MB_ICONEXCLAMATION);
if (choice == IDOK) {
    /// setting values///
}
else if (choice == IDHELP) {
    else Form1->Show();
}

You can of course use a switch statement. If you need information about these things, see The Definitive C++ Book Guide and List

sehe
  • 374,641
  • 47
  • 450
  • 633
  • Thanks for your respond :) minutes ago i come to the same solution and it works, thanks – kevin Oct 06 '17 at 12:55
  • Welcome to SO. Please also read [this](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) – sehe Oct 06 '17 at 12:56