Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I show a Win32 MessageBox?

I'm trying to make a pop up message box with "Hello World" written on it. I started off with File>New Project>Visual C++>CLR>Windows Form Application Then I dragged a button from the toolbox onto the form, double clicked it entered

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
MessageBox("Hello World");
}

then I compiled... but I got an error message saying

error C2440: '' : cannot convert from 'const char [12]' to 'System::Windows::Forms::MessageBox'

like image 407
user133466 Avatar asked Jan 21 '26 04:01

user133466


1 Answers

You need:

MessageBox::Show("Hello World");

(Tested according to your instructions in Visual Studio 2005.)

like image 63
RichieHindle Avatar answered Jan 22 '26 23:01

RichieHindle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!