Click here to Skip to main content
15,881,715 members
Articles / Mobile Apps

CCeFileFind - A FileFind class for Windows CE

Rate me:
Please Sign up or sign in to vote.
4.36/5 (5 votes)
21 Nov 2001CPOL 101.1K   322   30   14
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Ireland Ireland
A very confused human being, a slightly less confused developer.

Comments and Discussions

 
QuestionOne File is always lost Pin
TEisenhauer25-Feb-08 20:15
TEisenhauer25-Feb-08 20:15 
GeneralWin32 not MFC version Pin
Anonymous7-Dec-04 13:43
Anonymous7-Dec-04 13:43 
GeneralDrive mapping under CE Pin
Alex Evans23-Sep-04 18:23
Alex Evans23-Sep-04 18:23 
GeneralRe: Drive mapping under CE Pin
Ray Kinsella23-Sep-04 22:41
Ray Kinsella23-Sep-04 22:41 
GeneralRe: Drive mapping under CE Pin
Alex Evans24-Sep-04 17:31
Alex Evans24-Sep-04 17:31 
GeneralLink Error Help ned Pin
pakolaw26-May-03 22:08
pakolaw26-May-03 22:08 
GeneralRe: Link Error Help ned Pin
Ray Kinsella26-May-03 23:20
Ray Kinsella26-May-03 23:20 
GeneralRe: Link Error Help ned Pin
pakolaw26-May-03 23:29
pakolaw26-May-03 23:29 
GeneralRe: Link Error Help ned Pin
Ray Kinsella26-May-03 23:35
Ray Kinsella26-May-03 23:35 
GeneralRe: Link Error Help ned Pin
editfmah8-May-07 11:52
editfmah8-May-07 11:52 
GeneralRe: Link Error Help ned Pin
saephoed13-Mar-08 0:31
saephoed13-Mar-08 0:31 
GeneralBug Pin
machiav16-Dec-02 22:28
machiav16-Dec-02 22:28 
GeneralRe: Bug Pin
Ray Kinsella16-Dec-02 22:32
Ray Kinsella16-Dec-02 22:32 
GeneralRe: Bug Pin
piemelvriend22-Jul-04 22:38
piemelvriend22-Jul-04 22:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.