MainApp\RPolarView.cpp(1571): error C2664: “ATL::CStringT<BaseType,StringTraits>::ReverseFind”: 不能將參數 1 從“const char [2]”轉換為“wchar_t”
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC_DLL<wchar_t>
1> ]
1> 沒有使該轉換得以執行的上下文
CString GetModulePath(CString name) { char lpFilename[2000]; DWORD nSize = 2000; // 得到應用程序的文件名 GetModuleFileName(NULL,L"lpFilename",nSize); CString strFileName = (CString)lpFilename; int pos = strFileName.ReverseFind("\\"); if(pos<0) return L""; return strFileName.Left(pos+1)+name; };
改成:
即可
CString GetModulePath(CString name) { char lpFilename[2000]; DWORD nSize = 2000; // 得到應用程序的文件名 GetModuleFileName(NULL,L"lpFilename",nSize); CString strFileName = (CString)lpFilename; int pos = strFileName.ReverseFind('\\'); if(pos<0) return L""; return strFileName.Left(pos+1)+name; };