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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Studio
  4. problem with MessageBox

problem with MessageBox

Scheduled Pinned Locked Moved Visual Studio
helpcsharpvisual-studiotutorialquestion
5 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.
  • L Offline
    L Offline
    Lord_Vader
    wrote on last edited by
    #1

    Hello everybody,I have just purchased Visual Studio 2005 and I have problem with the MessageBox funtion!!! when I write for example MessageBoc("Hello") an error occurs: cannot convert parameter 1 from 'const char [6]' to 'LPCTSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast why? In Visual Studio 6 there is no such problem please help

    S C F 3 Replies Last reply
    0
    • L Lord_Vader

      Hello everybody,I have just purchased Visual Studio 2005 and I have problem with the MessageBox funtion!!! when I write for example MessageBoc("Hello") an error occurs: cannot convert parameter 1 from 'const char [6]' to 'LPCTSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast why? In Visual Studio 6 there is no such problem please help

      S Offline
      S Offline
      sachinmali
      wrote on last edited by
      #2

      check ur coding MessageBox("Hello") ----->>Right MessageBoc("Hello") ----->>Wrong Sachin Think of your goal when you are confused.

      C 1 Reply Last reply
      0
      • L Lord_Vader

        Hello everybody,I have just purchased Visual Studio 2005 and I have problem with the MessageBox funtion!!! when I write for example MessageBoc("Hello") an error occurs: cannot convert parameter 1 from 'const char [6]' to 'LPCTSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast why? In Visual Studio 6 there is no such problem please help

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        It's because unicode is enabled. You have two options: either disable unicode or use unicode strings: For the first solution, go into the project properties, C/C++ tab, preprocessor. In the "Preprocessor definitions" option, (you have to check on the grey button with '...' on it), uncheck "Inherit from parent or project defaults". This will disable unicode. For the second solution, use MessageBox(_T("Hello"));. This will tell the compiler that "Hello" is an unicode string.


        Cédric Moonen Software developer
        Charting control

        1 Reply Last reply
        0
        • S sachinmali

          check ur coding MessageBox("Hello") ----->>Right MessageBoc("Hello") ----->>Wrong Sachin Think of your goal when you are confused.

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          It was a typo in his post only. Otherwise the error message would have been different: 'MessageBoc': identifier not found


          Cédric Moonen Software developer
          Charting control

          1 Reply Last reply
          0
          • L Lord_Vader

            Hello everybody,I have just purchased Visual Studio 2005 and I have problem with the MessageBox funtion!!! when I write for example MessageBoc("Hello") an error occurs: cannot convert parameter 1 from 'const char [6]' to 'LPCTSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast why? In Visual Studio 6 there is no such problem please help

            F Offline
            F Offline
            Fletch57
            wrote on last edited by
            #5

            >>MessageBoc("Hello") Maybe it wants MessageBox(_T("Hello"))

            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