Click here to Skip to main content
15,569,768 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Access Violation CwinThread::CreateThread Pin
ForNow4-Aug-13 3:46
ForNow4-Aug-13 3:46 
QuestionRe: Access Violation CwinThread::CreateThread Pin
Richard MacCutchan4-Aug-13 4:53
mveRichard MacCutchan4-Aug-13 4:53 
AnswerRe: Access Violation CwinThread::CreateThread Pin
ForNow4-Aug-13 7:23
ForNow4-Aug-13 7:23 
AnswerRe: Access Violation CwinThread::CreateThread Pin
Erudite_Eric5-Aug-13 23:46
Erudite_Eric5-Aug-13 23:46 
GeneralRe: Access Violation CwinThread::CreateThread Pin
ForNow6-Aug-13 2:21
ForNow6-Aug-13 2:21 
GeneralRe: Access Violation CwinThread::CreateThread Pin
Joe Woodbury9-Aug-13 12:12
professionalJoe Woodbury9-Aug-13 12:12 
GeneralRe: Access Violation CwinThread::CreateThread Pin
Erudite_Eric17-Aug-13 0:04
Erudite_Eric17-Aug-13 0:04 
AnswerRe: Access Violation CwinThread::CreateThread Pin
Stephen Hewitt7-Aug-13 21:55
Stephen Hewitt7-Aug-13 21:55 
ForNow wrote:
m_pMainWnd->MessageBox((LPCTSTR)"SockClientThreadFail",NULL,MB_ICONERROR);


Look at the underlined section. What are you hoping to achieve by the cast? If you're compiling for non-Unicode it does nothing and if it's a Unicode build it tells the compiler not to issue an error but to shut up and assume the ANSI string is a Unicode one, which it's clearly not. Best case scenario is a garbled string in the message box, worst case an access violation because of no double NULL terminator. This is the typical fate of the cast-happy: turning a compile-time error into a runtime one. Don't cast if you don't know what's going on or fumble around casting to suppress a compiler error.

You don't need any casts:
m_pMainWnd->MessageBox(_T("SockClientThreadFail"), NULL, MB_ICONERROR);

 
Steve

AnswerRe: Access Violation CwinThread::CreateThread Pin
pasztorpisti17-Aug-13 5:47
pasztorpisti17-Aug-13 5:47 
QuestionUsing stream_traits for file io serialization question Pin
EQ Learner3-Aug-13 13:03
EQ Learner3-Aug-13 13:03 
AnswerRe: Using stream_traits for file io serialization question Pin
«_Superman_»4-Aug-13 21:22
professional«_Superman_»4-Aug-13 21:22 
QuestionHow to find the shortest path between two nodes in a undigraph and it should via several given nodes? Pin
ahuzhangbo2-Aug-13 19:53
ahuzhangbo2-Aug-13 19:53 
AnswerRe: How to find the shortest path between two nodes in a undigraph and it should via several given nodes? Pin
Richard MacCutchan2-Aug-13 22:51
mveRichard MacCutchan2-Aug-13 22:51 
AnswerRe: How to find the shortest path between two nodes in a undigraph and it should via several given nodes? Pin
Erudite_Eric3-Aug-13 4:23
Erudite_Eric3-Aug-13 4:23 
QuestionMFC FeaturePack application is not running in client PC. Pin
Anu_Bala1-Aug-13 21:19
Anu_Bala1-Aug-13 21:19 
AnswerRe: MFC FeaturePack application is not running in client PC. Pin
Richard MacCutchan1-Aug-13 21:24
mveRichard MacCutchan1-Aug-13 21:24 
GeneralRe: MFC FeaturePack application is not running in client PC. Pin
Anu_Bala1-Aug-13 22:28
Anu_Bala1-Aug-13 22:28 
GeneralRe: MFC FeaturePack application is not running in client PC. Pin
Richard MacCutchan1-Aug-13 22:57
mveRichard MacCutchan1-Aug-13 22:57 
GeneralRe: MFC FeaturePack application is not running in client PC. Pin
Anu_Bala1-Aug-13 23:08
Anu_Bala1-Aug-13 23:08 
QuestionRe: MFC FeaturePack application is not running in client PC. Pin
Richard MacCutchan1-Aug-13 23:02
mveRichard MacCutchan1-Aug-13 23:02 
AnswerRe: MFC FeaturePack application is not running in client PC. Pin
Argonia2-Aug-13 4:25
professionalArgonia2-Aug-13 4:25 
AnswerRe: MFC FeaturePack application is not running in client PC. Pin
«_Superman_»4-Aug-13 21:13
professional«_Superman_»4-Aug-13 21:13 
QuestionHow to store and retrieve data from database via internet using VC++2008 Pin
shanmugarajaa1-Aug-13 19:46
shanmugarajaa1-Aug-13 19:46 
AnswerRe: How to store and retrieve data from database via internet using VC++2008 Pin
Richard MacCutchan1-Aug-13 21:23
mveRichard MacCutchan1-Aug-13 21:23 
GeneralRe: How to store and retrieve data from database via internet using VC++2008 Pin
shanmugarajaa1-Aug-13 21:29
shanmugarajaa1-Aug-13 21:29 

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.