Valhalla Legends Forums Archive | .NET Platform | [C++ .Net] MessageBox::Show

AuthorMessageTime
bethra
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:
[code]
MessageBox::Show(S"It worked!", S"Message...");
[/code]

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
[/quote]

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?
January 19, 2005, 12:11 AM
Myndfyr
Just to be sure, you definitely included:

[code]
#using <System.Windows.Forms.dll>

using namespace System::Windows::Forms;
[/code]
?

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

[code]
#ifdef UNICODE
#define MessageBox MessageBoxW
#else
#define MessageBox MessageBoxA
#endif
[/code]

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!  :)
January 19, 2005, 12:17 AM
bethra
[quote author=MyndFyre link=topic=10233.msg95693#msg95693 date=1106093824]
Just to be sure, you definitely included:

[code]
#using <System.Windows.Forms.dll>

using namespace System::Windows::Forms;
[/code]
?

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

[code]
#ifdef UNICODE
#define MessageBox MessageBoxW
#else
#define MessageBox MessageBoxA
#endif
[/code]

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!  :)
[/quote]

yeah... that fixed it!  sorry kekekekeke
January 19, 2005, 12:20 AM

Search