Y
yeye yaya
Hello,
Why doesn't this work? it says
" error C2450: switch expression of type 'class CString' is illegal
No user-defined-conversion operator available that can perform this
conversion, or the operator cannot be called "
And is there a solution?
//Code starts here
void CDay2Dlg::OnRunpgm()
{
UpdateData(true);
CString strPgmName;
strPgmName = m_strProgToRun;
strPgmName.MakeUpper();
switch(strPgmName) {
case "PAINT":
WinExec("pbrush.exe",SW_SHOW);
break;
case "NOTEPAD":
WinExec("notepad.exe",SW_SHOW);
break;
case "SOLITAIRE":
WinExec ("sol.exe",SW_SHOW);
break;
}
}
Why doesn't this work? it says
" error C2450: switch expression of type 'class CString' is illegal
No user-defined-conversion operator available that can perform this
conversion, or the operator cannot be called "
And is there a solution?
//Code starts here
void CDay2Dlg::OnRunpgm()
{
UpdateData(true);
CString strPgmName;
strPgmName = m_strProgToRun;
strPgmName.MakeUpper();
switch(strPgmName) {
case "PAINT":
WinExec("pbrush.exe",SW_SHOW);
break;
case "NOTEPAD":
WinExec("notepad.exe",SW_SHOW);
break;
case "SOLITAIRE":
WinExec ("sol.exe",SW_SHOW);
break;
}
}