<p>I would like to keep the overhead at a minimum. Right now I have:</p>

<pre><code>// Launch a Message Box with advice to the user
DialogResult result = MessageBox::Show("This may take awhile, do you wish to continue?", "Warning", MessageBoxButtons::YesNo, MessageBoxIcon::Exclamation);

// The test will only be launched if the user has selected Yes on the Message Box
if(result == DialogResult::Yes)
{
    // Execute code
}
</code></pre>

<p>Unfortunately my client would prefer "Continue" and "Cancel" in place of the default "Yes" and "No" button text. It seems like there should be an easy way to do this.</p>

[{'answer_id': 77457, 'author': 'Corin Blaikie', 'author_id': 1736, 'author_profile': 'https://Stackoverflow.com/users/1736', 'pm_score': 3, 'selected': True, 'text': '<p>You can use "OK" and "Cancel"</p>\n\n<p>By substituting <code>MessageBoxButtons::YesNo</code> with <code>MessageBoxButtons::OKCancel</code></p>\n\n<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.messageboxbuttons.aspx" rel="nofollow noreferrer">MessageBoxButtons Enum</a></p>\n\n<p>Short of that you would have to create a new form, as I don\'t believe the Enum can be extended.</p>\n'}, {'answer_id': 86358, 'author': 'Andrew Dunaway', 'author_id': 9058, 'author_profile': 'https://Stackoverflow.com/users/9058', 'pm_score': 0, 'selected': False, 'text': '<p>From everything I can find it looks like <a href="https://stackoverflow.com/users/1736/corin">Corin</a> is right. Here is the code that I used to accomplish the original goal. I am not usually a Managed C++ programmer, so any editing would be appreciated.</p>\n\n<p>CustomMessageBox.h:</p>\n\n<pre><code>using namespace System::Windows::Forms;\n\n/// &lt;summary&gt;\n/// A message box for the test. Used to ensure user wishes to continue before starting the test.\n/// &lt;/summary&gt;\npublic ref class CustomMessageBox : Form\n{\nprivate:\n    /// Used to determine which button is pressed, default action is Cancel\n    static String^ Button_ID_ = "Cancel";\n\n    // GUI Elements\n    Label^ warningLabel_;\n    Button^ continueButton_;\n    Button^ cancelButton_;\n\n    // Button Events\n    void CustomMessageBox::btnContinue_Click(System::Object^ sender, EventArgs^ e);\n    void CustomMessageBox::btnCancel_Click(System::Object^ sender, EventArgs^ e);\n\n    // Constructor is private. CustomMessageBox should be accessed through the public ShowBox() method\n    CustomMessageBox();\n\npublic:\n    /// &lt;summary&gt;\n    /// Displays the CustomMessageBox and returns a string value of "Continue" or "Cancel"\n    /// &lt;/summary&gt;\n    static String^ ShowBox();\n};\n</code></pre>\n\n<p>CustomMessageBox.cpp:</p>\n\n<pre><code>#include "StdAfx.h"\n#include "CustomMessageBox.h"\n\nusing namespace System::Windows::Forms;\nusing namespace System::Drawing;\n\nCustomMessageBox::CustomMessageBox()\n{\n    this-&gt;Size = System::Drawing::Size(420, 150);\n    this-&gt;Text="Warning";\n    this-&gt;AcceptButton=continueButton_;\n    this-&gt;CancelButton=cancelButton_;\n    this-&gt;FormBorderStyle= ::FormBorderStyle::FixedDialog;\n    this-&gt;StartPosition= FormStartPosition::CenterScreen;\n    this-&gt;MaximizeBox=false;\n    this-&gt;MinimizeBox=false;\n    this-&gt;ShowInTaskbar=false;\n\n    // Warning Label\n    warningLabel_ = gcnew Label();\n    warningLabel_-&gt;Text="This may take awhile, do you wish to continue?";\n    warningLabel_-&gt;Location=Point(5,5);\n    warningLabel_-&gt;Size=System::Drawing::Size(400, 78);\n    Controls-&gt;Add(warningLabel_);\n\n    // Continue Button\n    continueButton_ = gcnew Button();\n    continueButton_-&gt;Text="Continue";\n    continueButton_-&gt;Location=Point(105,87);\n    continueButton_-&gt;Size=System::Drawing::Size(70,22);\n    continueButton_-&gt;Click += gcnew System::EventHandler(this, &amp;CustomMessageBox::btnContinue_Click);\n    Controls-&gt;Add(continueButton_);\n\n    // Cancel Button\n    cancelButton_ = gcnew Button();\n    cancelButton_-&gt;Text="Cancel";\n    cancelButton_-&gt;Location=Point(237,87);\n    cancelButton_-&gt;Size=System::Drawing::Size(70,22);\n    cancelButton_-&gt;Click += gcnew System::EventHandler(this, &amp;CustomMessageBox::btnCancel_Click);\n    Controls-&gt;Add(cancelButton_);\n}\n\n/// &lt;summary&gt;\n/// Displays the CustomMessageBox and returns a string value of "Continue" or "Cancel", depending on the button\n/// clicked.\n/// &lt;/summary&gt;\nString^ CustomMessageBox::ShowBox()\n{\n    CustomMessageBox^ box = gcnew CustomMessageBox();\n    box-&gt;ShowDialog();\n\n    return Button_ID_;\n}\n\n/// &lt;summary&gt;\n/// Event handler: When the Continue button is clicked, set the Button_ID_ value and close the CustomMessageBox.\n/// &lt;/summary&gt;\n/// &lt;param name="sender"&gt;The source of the event.&lt;/param&gt;\n/// &lt;param name="e"&gt;The &lt;see cref="System.EventArgs"/&gt; instance containing the event data.&lt;/param&gt;\nvoid CustomMessageBox::btnContinue_Click(System::Object^ sender, EventArgs^ e)\n{\n    Button_ID_ = "Continue";\n    this-&gt;Close();\n}\n\n/// &lt;summary&gt;\n/// Event handler: When the Cancel button is clicked, set the Button_ID_ value and close the CustomMessageBox.\n/// &lt;/summary&gt;\n/// &lt;param name="sender"&gt;The source of the event.&lt;/param&gt;\n/// &lt;param name="e"&gt;The &lt;see cref="System.EventArgs"/&gt; instance containing the event data.&lt;/param&gt;\nvoid CustomMessageBox::btnCancel_Click(System::Object^ sender, EventArgs^ e)\n{\n    Button_ID_ = "Cancel";\n    this-&gt;Close();\n}\n</code></pre>\n\n<p>And then finally the modification to the original code:</p>\n\n<pre><code>// Launch a Message Box with advice to the user\nString^ result = CustomMessageBox::ShowBox();\n\n// The test will only be launched if the user has selected Continue on the Message Box\nif(result == "Continue")\n{\n    // Execute Code\n}\n</code></pre>\n'}, {'answer_id': 13408763, 'author': 'Namhwan Sung', 'author_id': 1828322, 'author_profile': 'https://Stackoverflow.com/users/1828322', 'pm_score': 0, 'selected': False, 'text': '<p>Change the message as below. This may be the simplest way I think.</p>\n\n<pre><code>DialogResult result = MessageBox::Show(\n       "This may take awhile, do you wish to continue?**\\nClick Yes to continue.\\nClick No to cancel.**",\n       "Warning",\n       MessageBoxButtons::YesNo,\n       MessageBoxIcon::Exclamation\n);\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/77293', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9058/']