한국어/일본어 Windows에서 작동하려면 다음 코드가 필요합니다. 그냥 작동하지 않는다. 이유를 말해 줄 수 없다.Windows Search C++ (MFC) CFindFiles 경로 구분 기호
5 너희들 도와 줘?
void RecurseSearch(LPCTSTR pstr, CString serchTerm, CSimpleMap<CString,CString>* arr)
{
CFileFind finder;
// build a string with wildcards
CString strWildcard;
int code_point = 0x5c ;
WCHAR chr = (WCHAR) code_point;
strWildcard.Format(_T("%s%c*%s*"), pstr,chr,serchTerm);
CString actualFolder;
// start working for files
BOOL bWorking = finder.FindFile(strWildcard);
while (bWorking)
{
bWorking = finder.FindNextFile();
actualFolder=finder.GetFilePath();
// skip . and .. files; otherwise, we'd
// recur infinitely!
if (finder.IsDots())
continue;
// if it's a directory, recursively search it
else if (finder.IsDirectory())
{
CString str = finder.GetFilePath();
RecurseSearch(str, serchTerm, arr);
}
else
{
if(arr->GetSize()>200) return;
if(arr->FindKey(finder.GetFileURL())==-1)
arr->Add(finder.GetFileURL(),finder.GetFileURL());
}
}
bWorking = finder.FindFile(pstr+(CString)chr+(CString)_T("*"));
while(bWorking)
{
bWorking = finder.FindNextFile();
actualFolder =finder.GetFilePath();
if (!finder.IsDirectory() || finder.IsDots()) continue;
else
{
RecurseSearch(actualFolder, serchTerm, arr);
}
}
finder.Close();
}
이 코드는 미국 Windows에서 잘 작동하지만 한국어를하지 않습니다 ... 이 난 올바른 유니 코드 아무것도하지만 ...에
편집을 경로 구분 기호를 설정 : 내가 ' 오류를 식별 했으므로 ItemNames 및 ItemDisplayNames와 관련이 있습니다. ItemDisplayNames를 검색해야하지만 ItemName을 찾기 위해 CFindFile을 검색해야합니다.
ISearchFolderItemFactory를 사용하도록 코드를 변경 한 다음 AQS 쿼리를 수행합니다.
타이 녀석 어쨌든!
NOP! 작동하지 않습니다! 나는 이미 '/' '\\' '\' '\'트릭을하지 않는 것 같다! –
@Carlos_rpg : Odd. MFC의 어떤 버전입니까? 한국어 버전에서 '₩'의 문자 값은 무엇입니까? 예 :'printf ("0x % X \ n", '₩');'- MSFT에 따르면, 경로 sep는 모든 경우 0x5C이어야하며 단지 다른 문자로 표시되어야합니다. 적어도 그것이 내가 읽는 방식이다. – JimR