Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

MessageBox Error

simpulchordsimpulchord Member Posts: 26
I am using visual studios 2005 and microsoft xp service pack 3. I was writting a simplul dialog box and I added the code for the button MessageBox("Hello")
and I got this copmile error : error C2664: 'CWnd::MessageBoxW' : cannot convert parameter 1 from 'const char [6]' to 'LPCTSTR'

Please help me with this error

Comments

  • LundinLundin Member Posts: 3,711
    : I am using visual studios 2005 and microsoft xp service pack 3. I
    : was writting a simplul dialog box and I added the code for the
    : button MessageBox("Hello")
    : and I got this copmile error : error C2664: 'CWnd::MessageBoxW' :
    : cannot convert parameter 1 from 'const char [6]' to 'LPCTSTR'


    C++ (unlike C) will not allow implicit typecasts, which may cause this problem. The problem could also be caused by the compiler using Unicode as default string type.

    The best way to solve either of the 2 problems above when using Win API functions, is to use the TEXT() macro:


    TEXT("Hello")
  • simpulchordsimpulchord Member Posts: 26
    Thanx Lundin it works like a charm.
  • simpulchordsimpulchord Member Posts: 26
    Thanx Lundin it works like a charm.
  • simpulchordsimpulchord Member Posts: 26
    Thanx Lundin it works like a charm.
Sign In or Register to comment.