'WIN32 API'에 해당되는 글 1건
- 2008/06/16 How to search file on certain directory ?
Following example shows the example,
bool KFindFile(void *findname)
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
CString strSearch = (LPCTSTR)findname;
hFind = FindFirstFileEx( strSearch, FindExInfoStandard, &FindFileData, FindExSearchNameMatch, NULL, 0);
if (hFind==INVALID_HANDLE_VALUE)
{
MessageBox( NULL, CString("Invalid Handle Value"), CString("Error"), MB_OK);
return false;
}
else
{
MessageBox( NULL, (LPCTSTR)FindFileData.cFileName, (LPCTSTR)FindFileData.cFileName, MB_OK);
FindClose( hFind);
return true;
}
}
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
CString strSearch = (LPCTSTR)findname;
hFind = FindFirstFileEx( strSearch, FindExInfoStandard, &FindFileData, FindExSearchNameMatch, NULL, 0);
if (hFind==INVALID_HANDLE_VALUE)
{
MessageBox( NULL, CString("Invalid Handle Value"), CString("Error"), MB_OK);
return false;
}
else
{
MessageBox( NULL, (LPCTSTR)FindFileData.cFileName, (LPCTSTR)FindFileData.cFileName, MB_OK);
FindClose( hFind);
return true;
}
}
Above source works on Windows CE Platform as well. And you can use above function as below:
.
.
.
KFindFile( _T("\\My Documents\\My Pictures\\PIC-*.jpg"));
.
.
.
.
.
KFindFile( _T("\\My Documents\\My Pictures\\PIC-*.jpg"));
.
.
.

Prev

Rss Feed