• Welcome to Valhalla Legends Archive.
 

[C++ .Net] MessageBox::Show

Started by Sorc.Polgara, January 18, 2005, 06:11 PM

Previous topic - Next topic

Sorc.Polgara

I'm using this book for C++ .Net that I mistakenly bought awhile back because I thought it was for C++ (not .Net).  I had forgotten that I had it.

So now I can actually use it because I [MyndFyre-Edit]legitimately acquired[/MyndFyre-Edit] Visual Studio .Net.

Back on topic.

I am told to code:

MessageBox::Show(S"It worked!", S"Message...");


However, I can't compile it.  It gives me two errors that make completely no sense.

Quote
c:\Documents and Settings\John Doe\Desktop\Forms\CppForm.cpp(24): error C2653: 'MessageBoxA' : is not a class or namespace name

c:\Documents and Settings\John Doe\Desktop\Forms\CppForm.cpp(24): error C2660: 'System::Windows::Forms::Control::Show' : function does not take 2 arguments

This is totally whack.  I am not trying to use this "MessageBoxA".  wtf.  I didn't even type that in...

I am definitely sure that I have included the right #using information and namespaces because I'm done every step-by-step instruction that I was given.

Anyone have any idea what the problem is?

MyndFyre

Just to be sure, you definitely included:


#using <System.Windows.Forms.dll>

using namespace System::Windows::Forms;

?

Also, you're probably #including <windows.h>, right?  Well, I believe <windows.h> includes a #define something like this:


#ifdef UNICODE
#define MessageBox MessageBoxW
#else
#define MessageBox MessageBoxA
#endif


Amazing!  I just did an MSDN library search to see what header it was in, but hell I didn't need to!  This article describes exactly the problem you're having!  :)
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Sorc.Polgara

Quote from: MyndFyre on January 18, 2005, 06:17 PM
Just to be sure, you definitely included:


#using <System.Windows.Forms.dll>

using namespace System::Windows::Forms;

?

Also, you're probably #including <windows.h>, right?  Well, I believe <windows.h> includes a #define something like this:


#ifdef UNICODE
#define MessageBox MessageBoxW
#else
#define MessageBox MessageBoxA
#endif


Amazing!  I just did an MSDN library search to see what header it was in, but hell I didn't need to!  This article describes exactly the problem you're having!  :)

yeah... that fixed it!  sorry kekekekeke