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. Use MessageBox in Windows Forms

Use MessageBox in Windows Forms

Scheduled Pinned Locked Moved Managed C++/CLI
questionwinforms
3 Posts 2 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.
  • R Offline
    R Offline
    RafMar
    wrote on last edited by
    #1

    I heard that the compiler is confussed whith the use of MessageBox in Windows::Forms. Can anybody tell me what is the correct precompiler directive for the correct use of MessageBox Class in Windows::Forms??? THANK YOU, VERY MUCH

    T 1 Reply Last reply
    0
    • R RafMar

      I heard that the compiler is confussed whith the use of MessageBox in Windows::Forms. Can anybody tell me what is the correct precompiler directive for the correct use of MessageBox Class in Windows::Forms??? THANK YOU, VERY MUCH

      T Offline
      T Offline
      Tom Archer
      wrote on last edited by
      #2

      If you're trying to use the MessageBox class in a mixed mode app you'll run into compiler error because the WinUser.h file contains a #define that maps the MessageBox name to either the MessageBoxA (marshals the passed string to ANSI) or MessageBoxW (marshals the passed string to wide character format, or Unicode) function based on the project's defined character set option. If this is the case you have two options: 1) If you'll never use the Win32 MessageBox function, simply #undef it in the stdafx.h file. #undef MessageBox 2) If you only want to #undef the MessageBox within a given context, you can do the following: #pragma push_macro("MessageBox") #undef MessageBox // your code #pragma pop_macro("MessageBox") If you're writing a purely managed application, I don't think it's an issue but I never write managed only C++ apps so I'm not sure. Cheers, Tom Archer Inside C#,
      Extending MFC Applications with the .NET Framework It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson

      R 1 Reply Last reply
      0
      • T Tom Archer

        If you're trying to use the MessageBox class in a mixed mode app you'll run into compiler error because the WinUser.h file contains a #define that maps the MessageBox name to either the MessageBoxA (marshals the passed string to ANSI) or MessageBoxW (marshals the passed string to wide character format, or Unicode) function based on the project's defined character set option. If this is the case you have two options: 1) If you'll never use the Win32 MessageBox function, simply #undef it in the stdafx.h file. #undef MessageBox 2) If you only want to #undef the MessageBox within a given context, you can do the following: #pragma push_macro("MessageBox") #undef MessageBox // your code #pragma pop_macro("MessageBox") If you're writing a purely managed application, I don't think it's an issue but I never write managed only C++ apps so I'm not sure. Cheers, Tom Archer Inside C#,
        Extending MFC Applications with the .NET Framework It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson

        R Offline
        R Offline
        RafMar
        wrote on last edited by
        #3

        Thank you Tom. It's OK ::-D

        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