Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

CCeFileFind - A FileFind class for Windows CE

0.00/5 (No votes)
21 Nov 2001 1  
CCeFileFind - A FileFind class for Windows CE.

Introduction

This class was originally posted by Waseem Anis on CodeGuru. However after misunderstanding how the class works and finding (and subsequently fixing) several bugs, I decided that Waseem's article and code although excellent, needed some clarification.

As most Windows CE programmers know, Microsoft has not provided a FindFile MFC class to wrap the Windows CE FindFile APIs. This functionality lacking in the Windows CE SDK is provided in the CCeFileFind.

Using the class

The example code below demonstrates using the CeFileFind class to determine the device's storage card directory.

CCeFileFind p_ff;
BOOL bFilesFound =  p_ff.FindFile(_T("\\*"));

while(bFilesFound)
{
    bFilesFound = p_ff.FindNextFile();
    if(p_ff.IsTemporary() && p_ff.IsDirectory())
    {
        m_csDirectoryName = p_ff.GetFileName();
        break;
    }
}

NB. Note how FindFile is executed first, then FindNextFile is executed and then GetFileName is executed. FindFile and FindNextFile must occur in the demonstrated order. Any further questions or queries, feel free to contact me.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here