"Chris3147" wrote:
(I am using VS 2003 .NET with a Windows Form Application project. .NET
Framework 1.1)
I am trying to use the simple MessageBox::Show(System::String)
When I start typing just to see if it is there, I'll type
System::Windows::Forms::MessageBox::Show and it all comes up right, but, when
I go to compile it tells me:
error C2653: 'MessageBoxA' : is not a class or namespace name
when I am using it like this:
MessageBox::Show((System::String*)"Hello World.");
Can somebody let me know what I'm doing wrong and give me the correct way to
use it?
Thanks
~Chris
Just an update.
I am trying to define the function in the Form1.cpp
I have the function prototyped in Form1.h (where it places it when you
double-click an object).
Then, I the function in the .cpp file like this:
System::Void My_Project::Form1::button1_click(...)
{
}
If I put the MessageBox::Show("Hello World.") in the function in the .h it
works fine, but when I do it in the .cpp, it gives me the above error.
Now, can anyone tell me how to use the MessageBox from within the function
definition in the .cpp file, or am I doing something wrong?
Should I declare all my stuff in the .h? I thought about putting it in the
.cpp file since typically .h files aren't compiled, but is it different when
using these Windows .NET projects? Thanks.
MessageBoxA in an ANSI build and MessageBoxW in a Unicode build. One way
int APIENTRY _tWinMain ....
Another is to move _tWinMain to its own file, e.g. main.cpp so that only
main.cpp includes windows.h.