Click here to Skip to main content
15,881,803 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Access Violation CwinThread::CreateThread Pin
ForNow4-Aug-13 2:46
ForNow4-Aug-13 2:46 
QuestionRe: Access Violation CwinThread::CreateThread Pin
Richard MacCutchan4-Aug-13 3:53
mveRichard MacCutchan4-Aug-13 3:53 
AnswerRe: Access Violation CwinThread::CreateThread Pin
ForNow4-Aug-13 6:23
ForNow4-Aug-13 6:23 
AnswerRe: Access Violation CwinThread::CreateThread Pin
Erudite_Eric5-Aug-13 22:46
Erudite_Eric5-Aug-13 22:46 
GeneralRe: Access Violation CwinThread::CreateThread Pin
ForNow6-Aug-13 1:21
ForNow6-Aug-13 1:21 
GeneralRe: Access Violation CwinThread::CreateThread Pin
Joe Woodbury9-Aug-13 11:12
professionalJoe Woodbury9-Aug-13 11:12 
GeneralRe: Access Violation CwinThread::CreateThread Pin
Erudite_Eric16-Aug-13 23:04
Erudite_Eric16-Aug-13 23:04 
AnswerRe: Access Violation CwinThread::CreateThread Pin
Stephen Hewitt7-Aug-13 20:55
Stephen Hewitt7-Aug-13 20: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 4:47
pasztorpisti17-Aug-13 4:47 
QuestionUsing stream_traits for file io serialization question Pin
EQ Learner3-Aug-13 12:03
EQ Learner3-Aug-13 12:03 
AnswerRe: Using stream_traits for file io serialization question Pin
«_Superman_»4-Aug-13 20:22
professional«_Superman_»4-Aug-13 20:22 
QuestionHow to find the shortest path between two nodes in a undigraph and it should via several given nodes? Pin
ahuzhangbo2-Aug-13 18:53
ahuzhangbo2-Aug-13 18: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 21:51
mveRichard MacCutchan2-Aug-13 21: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 3:23
Erudite_Eric3-Aug-13 3:23 
QuestionMFC FeaturePack application is not running in client PC. Pin
Anu_Bala1-Aug-13 20:19
Anu_Bala1-Aug-13 20:19 
AnswerRe: MFC FeaturePack application is not running in client PC. Pin
Richard MacCutchan1-Aug-13 20:24
mveRichard MacCutchan1-Aug-13 20:24 
GeneralRe: MFC FeaturePack application is not running in client PC. Pin
Anu_Bala1-Aug-13 21:28
Anu_Bala1-Aug-13 21:28 
GeneralRe: MFC FeaturePack application is not running in client PC. Pin
Richard MacCutchan1-Aug-13 21:57
mveRichard MacCutchan1-Aug-13 21:57 
GeneralRe: MFC FeaturePack application is not running in client PC. Pin
Anu_Bala1-Aug-13 22:08
Anu_Bala1-Aug-13 22:08 
QuestionRe: MFC FeaturePack application is not running in client PC. Pin
Richard MacCutchan1-Aug-13 22:02
mveRichard MacCutchan1-Aug-13 22:02 
AnswerRe: MFC FeaturePack application is not running in client PC. Pin
Argonia2-Aug-13 3:25
professionalArgonia2-Aug-13 3:25 
AnswerRe: MFC FeaturePack application is not running in client PC. Pin
«_Superman_»4-Aug-13 20:13
professional«_Superman_»4-Aug-13 20:13 
QuestionHow to store and retrieve data from database via internet using VC++2008 Pin
shanmugarajaa1-Aug-13 18:46
shanmugarajaa1-Aug-13 18:46 
AnswerRe: How to store and retrieve data from database via internet using VC++2008 Pin
Richard MacCutchan1-Aug-13 20:23
mveRichard MacCutchan1-Aug-13 20:23 
GeneralRe: How to store and retrieve data from database via internet using VC++2008 Pin
shanmugarajaa1-Aug-13 20:29
shanmugarajaa1-Aug-13 20: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.