Messageboxes in managed C++
-
How on earth do you call them? I've tried all sorts of methods, the latest being MessageBox::Show("Text", "More text"); from a tutorial on the site but I just get compiler errors like MessageBoxA is not a class or namespace name or MessageBox is not a part of System::Windows::Forms (when intellisense tells you it is). The onlt way to do it so far it via #prgama unmanaged void CallMsgBox() { MessageBox(NULL, "Old style msg box", "Caption", MB_OK); } #pragma managed So how do you call it??? Thanks Obseve everything, remember more...
-
How on earth do you call them? I've tried all sorts of methods, the latest being MessageBox::Show("Text", "More text"); from a tutorial on the site but I just get compiler errors like MessageBoxA is not a class or namespace name or MessageBox is not a part of System::Windows::Forms (when intellisense tells you it is). The onlt way to do it so far it via #prgama unmanaged void CallMsgBox() { MessageBox(NULL, "Old style msg box", "Caption", MB_OK); } #pragma managed So how do you call it??? Thanks Obseve everything, remember more...
-
Its silly really :) MessageBox::Show(S"Text", S"More text"); You need to prepend mamanged strings with a S. leppie::AllocCPArticle("Zee blog");
Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.leppie, I think his problem is not with strings. Instead it is that the preprocessor sees that MessageBox is defined as either MessageBoxA or MessageBoxU depending on build enviroment. The solution should be something like:
... // this undefines the MessageBox macro #undef MessageBox // This should now work MessageBox::Show(S"Some text",S"Some text 2"); ...
Or maybe I am just on crack or something... Feel free to flame me... -Nathan --------------------------- Hmmm... what's a signature? -
How on earth do you call them? I've tried all sorts of methods, the latest being MessageBox::Show("Text", "More text"); from a tutorial on the site but I just get compiler errors like MessageBoxA is not a class or namespace name or MessageBox is not a part of System::Windows::Forms (when intellisense tells you it is). The onlt way to do it so far it via #prgama unmanaged void CallMsgBox() { MessageBox(NULL, "Old style msg box", "Caption", MB_OK); } #pragma managed So how do you call it??? Thanks Obseve everything, remember more...
Had the same problem and found the solution in one of Microsoft's articles. At the beginning of the.cpp file, after the includes, I put the following: #ifdef MessageBox #undef MessageBox #endif The problem seems to be caused by a confliction in MessageBox declarations between the .Net declaration and the one in the windows.h file. Cheers