CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2011
    Posts
    2

    messagebox problem with visual c++ 2008 express edition

    Hi there

    I am new to C++, and I am using vc++ 2008 express edition. When I compile the code with DEV C++ it works fine but not with MS express edition.
    It leaves me an error as

    : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [28]' to 'LPCWSTR'
    1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

    {
    MessageBox(0,"My message Box", "MB",MB_OK);
    }

    Can any one leave a reply asap.
    And thanks in advance

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: messagebox problem with visual c++ 2008 express edition

    Sounds like a problem with ANSI/UNICODE build.
    Try
    Code:
    MessageBox(0, _T("My message Box"), _T("MB"), MB_OK);
    Victor Nijegorodov

  3. #3
    Join Date
    Feb 2011
    Posts
    2

    Re: messagebox problem with visual c++ 2008 express edition

    Thanks for the reply.

    But it didn't solve my problem. Its leaving me an another kind of error .

    _T as identifier not found.

    sir,
    What is _T here? can you please explain me a bit.

    Thanks in aadvance.

  4. #4
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: messagebox problem with visual c++ 2008 express edition

    Code:
    #include <tchar.h>
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  5. #5
    Join Date
    Mar 2011
    Posts
    1

    Wink Re: messagebox problem with visual c++ 2008 express edition

    You may refer to the site below
    http://thoughtsfrommylife.com/articl...o_Express_2008

    The main process would be

    1.Project -> [projectname] Properties
    2.In the Configuration dropdown, pick All Configurations.
    3.Expand Configuration Properties.
    4.Select General.
    5.Change the Character Set to be Use Multi-Byte Character Set.

    It is a copy from that page.

    Good luck to you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured