-
January 7th, 2017, 09:00 AM
#1
[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
-
January 7th, 2017, 10:40 AM
#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
-
January 18th, 2017, 12:18 PM
#3
Re: Problem on programming by using VS2012
Originally Posted by trader68
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.
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|