Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Messageboxes in managed C++

Messageboxes in managed C++

Scheduled Pinned Locked Moved Managed C++/CLI
c++visual-studiotutorialquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tom76
    wrote on last edited by
    #1

    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...

    L B 2 Replies Last reply
    0
    • T tom76

      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...

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      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.

      N 1 Reply Last reply
      0
      • L leppie

        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.

        N Offline
        N Offline
        Nathan Blomquist
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0
        • T tom76

          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...

          B Offline
          B Offline
          bollwerj
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups