VC高手帮帮忙,WinExec意外出错,自己找不到原因,
代码如下,在VC6下正确运行,但是在2005下会提示 The specified file was not found.不知道为什么,找不出原因,请高手帮忙,谢谢!
CString str = m_List.GetItemText(i,0);
str.Format(TEXT("%s"),TEXT("cmd.exe /c md \\\\?\\") + str + TEXT("AutoRun.inf\\Dubing'sProtection..\\"));
MessageBox(str,TEXT("提示"),MB_OK);
LPCWSTR lpsz =(LPCWSTR)(LPCTSTR)str;
UINT rlt=WinExec(lpsz,SW_NORMAL);
switch (rlt)
{
case 0:
MessageBox(TEXT("GOOD"),TEXT("提示"),MB_OK);break;
case ERROR_BAD_FORMAT:
MessageBox(TEXT("The .exe file is invalid."),TEXT("提示"),MB_OK);break;
case ERROR_FILE_NOT_FOUND:
MessageBox(TEXT("The specified file was not found."),TEXT("提示"),MB_OK);break;
case ERROR_PATH_NOT_FOUND:
MessageBox(TEXT("The specified path was not found."),TEXT("提示"),MB_OK);
}
}