dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: [RESOLVED] Problem on programming by using VS2012

  1. #1
    Join Date
    Jan 2010
    Posts
    2

    [RESOLVED] Problem on programming by using VS2012

    Hi programmers,
    in these, after several years on using Visual Studio 6, I migrate to Visual Studio 2012 and I start with troubles.
    I suppose that I lost several informations in these years, but I neither able to use CString or Messagebox() and, obviously, some frustration got over me.
    Could you please tell me what was wrong?
    I reported just a couple of line of easy code, just to understand what is wrong.

    CString str;
    int a =4;

    str.Format("%d",a); // <==== FAIL
    MessageBox("Help, Something went wrong."); <==== FAIL

    MessageBox(_T("Help, Something went wrong."));
    MessageBox(stra);


    Before I could write just MessageBox("test"); without problem, now it seems not possible, I must declare _T

    MessageBox(_T.......

    Moreover It seems that str.Format("%d",a); could not be used anymore, why?

    Sorry for the low level of my question, but if you could clarify these easy problem, I would be gratefull.
    Have a good day.
    Ciao
    Sergio

  2. #2
    Join Date
    Jan 2010
    Posts
    2

    Re: Problem on programming by using VS2012

    SOLVED!!
    it was just a Visual studio config.
    it was sufficient made this :
    Configuration Properties > General. Switch Character Set to "Use Multi-Byte Character Set".
    Sorry for disturb and have a good day.

    Ciao
    Sergio

  3. #3
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,207

    Re: Problem on programming by using VS2012

    Quote Originally Posted by trader68 View Post
    SOLVED!!
    it was just a Visual studio config.
    it was sufficient made this :
    Configuration Properties > General. Switch Character Set to "Use Multi-Byte Character Set".
    Sorry for posting late answer. I want just to note that above solution is a bad solution, leading in performance penalties. That's because the NT platforms (including the latest Windows versions) natively use UNICODE and not ANSI (multi-byte) strings.

    So better, let "Use Unicode Character Set" and edit your old code in order to use UNICODE strings, i.e. write L"something" instead of "something", or if you really-really need ANSI builds, write _T("something").

    See: Which Windows API functions are faster, ANSI or UNICODE?
    Last edited by ovidiucucu; January 18th, 2017 at 12:25 PM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: http://codexpert.ro/blog/author/ovidiu-cucu/

Tags for this Thread

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)