Click here to Skip to main content
15,914,417 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionChanging Dialog Button Color at runTime Pin
002comp20-Nov-12 23:07
002comp20-Nov-12 23:07 
AnswerRe: Changing Dialog Button Color at runTime Pin
manoranjan21-Nov-12 0:05
manoranjan21-Nov-12 0:05 
GeneralRe: Changing Dialog Button Color at runTime Pin
002comp21-Nov-12 0:37
002comp21-Nov-12 0:37 
GeneralRe: Changing Dialog Button Color at runTime Pin
manoranjan21-Nov-12 1:12
manoranjan21-Nov-12 1:12 
GeneralRe: Changing Dialog Button Color at runTime Pin
002comp21-Nov-12 18:56
002comp21-Nov-12 18:56 
GeneralRe: Changing Dialog Button Color at runTime Pin
manoranjan21-Nov-12 19:40
manoranjan21-Nov-12 19:40 
QuestionPng Image button problem. Pin
yu-jian20-Nov-12 6:53
yu-jian20-Nov-12 6:53 
QuestionMinimize CDialog Problem Pin
yu-jian20-Nov-12 6:22
yu-jian20-Nov-12 6:22 
AnswerRe: Minimize CDialog Problem Pin
jeron120-Nov-12 6:31
jeron120-Nov-12 6:31 
QuestionRe: Minimize CDialog Problem Pin
Maximilien20-Nov-12 8:26
Maximilien20-Nov-12 8:26 
QuestionCheck if a character is lowercase and change to uppercase. Pin
MitchG92_2420-Nov-12 0:49
MitchG92_2420-Nov-12 0:49 
AnswerRe: Check if a character is lowercase and change to uppercase. Pin
MitchG92_2420-Nov-12 0:56
MitchG92_2420-Nov-12 0:56 
AnswerRe: Check if a character is lowercase and change to uppercase. Pin
Sajeesh Payolam20-Nov-12 17:34
Sajeesh Payolam20-Nov-12 17:34 
GeneralRe: Check if a character is lowercase and change to uppercase. Pin
Richard MacCutchan20-Nov-12 21:31
mveRichard MacCutchan20-Nov-12 21:31 
QuestionIs it possible to capture an HD video/ to generate videos in HD in C++/VC++/MFC.? Pin
mbatra3119-Nov-12 22:15
mbatra3119-Nov-12 22:15 
QuestionProblem with string conversion Pin
HungryCPPDev19-Nov-12 19:08
HungryCPPDev19-Nov-12 19:08 
AnswerRe: Problem with string conversion Pin
Jochen Arndt19-Nov-12 21:40
professionalJochen Arndt19-Nov-12 21:40 
GeneralRe: Problem with string conversion Pin
HungryCPPDev20-Nov-12 18:05
HungryCPPDev20-Nov-12 18:05 
GeneralRe: Problem with string conversion Pin
Jochen Arndt22-Nov-12 2:52
professionalJochen Arndt22-Nov-12 2:52 
Sorry for my late answer. I overlooked your reply.

The CStringT class constructors and assignment operators accepting the LPCSTR and LPCWSTR types will convert the string if it does not match (when assigning LPCWSTR to a CStringA object it is converted to ANSI and when assigning LPCSTR to a CStringW object it is converted to Unicode). The conversion is internally performed using WideCharToMultiByte() and MultiByteToWideChar() with code page CP_THREAD_ACP (when using Visual Studio 2003 and later; with older versions or manually set preprocessor definition _CONVERSION_DONT_USE_THREAD_LOCALE, CP_ACP is used). See the ATL/MFC source files cstringt.h and atlconv.h if you are interested in how the conversions are performed.

If you are not calling SetThreadLocale() within your app, the thread will use the system locale.

If the results from using WideCharToMultiByte() and CStringT constructors are different, you have passed a code page number that differs from the default code page of the used locale.

So you may post your settings here or check it yourself:

  • The code page passed to WideCharToMultiByte()
  • The code page used by the CStringT class

To get the code page used by the CStringT class use this code snippet (assuming CP_THREAD_ACP is used):
C++
// Default ANSI code page
int nCP = ::GetACP();
// Returns same as GetSystemDefaultLCID() when SetThreadLocale() has not been called.
LCID nLCID = ::GetThreadLocale();
TCHAR szACP[7];
if (::GetLocaleInfo(nLCID, LOCALE_IDEFAULTANSICODEPAGE, szACP, 7) != 0)
    nCP = _tstoi(szACP);

Now compare nCP with the value passed to WideCharToMultiByte().

All these different locales and code pages may be confusing. So I will sum up the settings that may effect your conversions:

  • The system locale including its default ANSI code page
  • The user's locale including its default ANSI code page
  • The thread's locale including its default ANSI code page
  • The code page used by the CStringT class
  • The code page passed to conversion functions in your code

QuestionHow to set the alignment of items of CListCtrl Pin
rahul.kulshreshtha19-Nov-12 16:43
rahul.kulshreshtha19-Nov-12 16:43 
AnswerRe: How to set the alignment of items of CListCtrl Pin
Richard MacCutchan19-Nov-12 22:50
mveRichard MacCutchan19-Nov-12 22:50 
GeneralRe: How to set the alignment of items of CListCtrl Pin
rahul.kulshreshtha19-Nov-12 23:22
rahul.kulshreshtha19-Nov-12 23:22 
GeneralRe: How to set the alignment of items of CListCtrl Pin
Richard MacCutchan20-Nov-12 0:02
mveRichard MacCutchan20-Nov-12 0:02 
GeneralRe: How to set the alignment of items of CListCtrl Pin
rahul.kulshreshtha20-Nov-12 16:30
rahul.kulshreshtha20-Nov-12 16:30 
GeneralRe: How to set the alignment of items of CListCtrl Pin
Richard MacCutchan20-Nov-12 21:17
mveRichard MacCutchan20-Nov-12 21:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.