Search results for 'Windows XP'. 1 post(s) found.
- 2008/06/16 How to search file on certain directory ?
In case of finding files on certain directory, you need to use FindFirstFileEx function.
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"));
.
.
.
Another posts included in "C, C++"
| How to call SetTimer function on MFC CDialog class ? (0) | 2008/07/30 |
| How to get GM Time as String ? (0) | 2009/03/20 |
| How to load HTML resource on MFC ? (0) | 2009/03/23 |
| How to run shell command by MFC ? (0) | 2007/09/09 |
| Binary Search Sample Code (0) | 2007/09/08 |
| Double Linked List (0) | 2007/09/08 |
| MFC based World Wide Web HTTP Server Source Code (0) | 2007/08/28 |
| Creating and Using a CAsyncSocket Object to use CAsyncSocket (0) | 2007/08/28 |

Prev

Rss Feed