Hello
I am writing a MFC application by using embedded visual C++ 4
I want to get a file list in specific directory
how can i do it?

Many thanks

Re: Get the file list by r_z_aret

r_z_aret
Fri Dec 31 15:13:29 CST 2004

On Sat, 1 Jan 2005 04:30:43 +0800, "Peter" <abc@hotmail.com> wrote:

>Hello
>I am writing a MFC application by using embedded visual C++ 4
>I want to get a file list in specific directory
>how can i do it?

This, or similar question, is asked every week or two. Unfortunately,
it's asked in so many different ways that using google to find the
answer is tricky.

I don't use MFC. I do know that the answer for straight Win32 (with VC
or eVC) is to use FindFirstFile and relatives. I just used grep to
search through the MFC source files for the Pocket PC 2003 SDK. That
led me to a function called CFileFind::FileFind in filefind.c. But I
could find neither CFileFind not FileFind when I used the index in
MSDN Library.

I just used google (http://groups.google.com/advanced_group_search) to
look up
mfc findfirstfile
in this newsgroup (microsoft.public.pocketpc.developer) and got 2
hits. The second was a 29-30 May 2003 thread called "Listing the
archives of a directory".

When I looked for the same strings without restricting the newsgroup,
I got 916 hits. I didn't check any.


>
>Many thanks
>

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com

Re: Get the file list by a-nlewis

a-nlewis
Fri Dec 31 19:19:07 CST 2004

------=_NextPart_0001_1582AC40
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

For some mysterious reason, CFileFind isn't implemented for Pocket PC, so
you'll have to use the FindFirstFile / FindNextFile APIs like so:

WIN32_FIND_DATA fd = {0};
CString sFolder = _T("\\FolderToSearch\\");
HANDLE hFind = FindFirstFile( sFolder + _T("*.*"), &fd );
BOOL bFound = ( INVALID_HANDLE_VALUE != hFind );

if( bFound )
{
do
{
CString sFile = fd.cFileName;
CString sPath = sFolder + sFile;
}
while( FindNextFile( hFind, &fd ) );

FindClose( hFind );
}


---

Nathan Lewis
Microsoft Mobile and Embedded Devices Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: r_z_aret@pen_fact.com
Subject: Re: Get the file list
Date: Fri, 31 Dec 2004 16:13:29 -0500

On Sat, 1 Jan 2005 04:30:43 +0800, "Peter" <abc@hotmail.com> wrote:

>Hello
>I am writing a MFC application by using embedded visual C++ 4
>I want to get a file list in specific directory
>how can i do it?

This, or similar question, is asked every week or two. Unfortunately,
it's asked in so many different ways that using google to find the
answer is tricky.

I don't use MFC. I do know that the answer for straight Win32 (with VC
or eVC) is to use FindFirstFile and relatives. I just used grep to
search through the MFC source files for the Pocket PC 2003 SDK. That
led me to a function called CFileFind::FileFind in filefind.c. But I
could find neither CFileFind not FileFind when I used the index in
MSDN Library.

I just used google (http://groups.google.com/advanced_group_search) to
look up
mfc findfirstfile
in this newsgroup (microsoft.public.pocketpc.developer) and got 2
hits. The second was a 29-30 May 2003 thread called "Listing the
archives of a directory".

When I looked for the same strings without restricting the newsgroup,
I got 916 hits. I didn't check any.


>
>Many thanks
>

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and
please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com

------=_NextPart_0001_1582AC40
Content-Type: text/x-rtf
Content-Transfer-Encoding: 7bit

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\f0\fs20 For some mysterious reason, CFileFind isn't implemented for Pocket PC, so you'll have to use the FindFirstFile / FindNextFile APIs like so:
\par
\par WIN32_FIND_DATA fd = \{0\};
\par CString sFolder = _T("\\\\FolderToSearch\\\\");
\par HANDLE hFind = FindFirstFile( sFolder + _T("*.*"), &fd );
\par BOOL bFound = ( INVALID_HANDLE_VALUE != hFind );
\par
\par if( bFound )
\par \{
\par do
\par \{
\par CString sFile = fd.cFileName;
\par CString sPath = sFolder + sFile;
\par \}
\par while( FindNextFile( hFind, &fd ) );
\par
\par FindClose( hFind );
\par \}
\par
\par
\par ---
\par
\par Nathan Lewis
\par Microsoft Mobile and Embedded Devices Developer Support
\par
\par This posting is provided "AS IS" with no warranties, and confers no rights.
\par
\par
\par \pard\li720 --------------------
\par From: r_z_aret@pen_fact.com
\par Subject: Re: Get the file list
\par Date: Fri, 31 Dec 2004 16:13:29 -0500
\par
\par On Sat, 1 Jan 2005 04:30:43 +0800, "Peter" <abc@hotmail.com> wrote:
\par
\par >Hello
\par >I am writing a MFC application by using embedded visual C++ 4
\par >I want to get a file list in specific directory
\par >how can i do it?
\par
\par This, or similar question, is asked every week or two. Unfortunately,
\par it's asked in so many different ways that using google to find the
\par answer is tricky.
\par
\par I don't use MFC. I do know that the answer for straight Win32 (with VC
\par or eVC) is to use FindFirstFile and relatives. I just used grep to
\par search through the MFC source files for the Pocket PC 2003 SDK. That
\par led me to a function called CFileFind::FileFind in filefind.c. But I
\par could find neither CFileFind not FileFind when I used the index in
\par MSDN Library.
\par
\par I just used google (http://groups.google.com/advanced_group_search) to
\par look up
\par mfc findfirstfile
\par in this newsgroup (microsoft.public.pocketpc.developer) and got 2
\par hits. The second was a 29-30 May 2003 thread called "Listing the
\par archives of a directory".
\par
\par When I looked for the same strings without restricting the newsgroup,
\par I got 916 hits. I didn't check any.
\par
\par
\par >
\par >Many thanks
\par >
\par
\par -----------------------------------------
\par To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
\par
\par Robert E. Zaret, eMVP
\par PenFact, Inc.
\par 500 Harrison Ave., Suite 3R
\par Boston, MA 02118
\par www.penfact.com
\par \pard
\par
\par }
------=_NextPart_0001_1582AC40--


Re: Get the file list by Peter

Peter
Tue Jan 04 03:44:30 CST 2005

Many thanks

"Nathan Lewis" <a-nlewis@online.microsoft.com> ¦b¶l¥ó
news:J$kAl$57EHA.2680@cpmsftngxa10.phx.gbl ¤¤¼¶¼g...
> For some mysterious reason, CFileFind isn't implemented for Pocket PC, so
> you'll have to use the FindFirstFile / FindNextFile APIs like so:
>
> WIN32_FIND_DATA fd = {0};
> CString sFolder = _T("\\FolderToSearch\\");
> HANDLE hFind = FindFirstFile( sFolder + _T("*.*"), &fd );
> BOOL bFound = ( INVALID_HANDLE_VALUE != hFind );
>
> if( bFound )
> {
> do
> {
> CString sFile = fd.cFileName;
> CString sPath = sFolder + sFile;
> }
> while( FindNextFile( hFind, &fd ) );
>
> FindClose( hFind );
> }
>
>
> ---
>
> Nathan Lewis
> Microsoft Mobile and Embedded Devices Developer Support
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
>
> --------------------
> From: r_z_aret@pen_fact.com
> Subject: Re: Get the file list
> Date: Fri, 31 Dec 2004 16:13:29 -0500
>
> On Sat, 1 Jan 2005 04:30:43 +0800, "Peter" <abc@hotmail.com> wrote:
>
> >Hello
> >I am writing a MFC application by using embedded visual C++ 4
> >I want to get a file list in specific directory
> >how can i do it?
>
> This, or similar question, is asked every week or two. Unfortunately,
> it's asked in so many different ways that using google to find the
> answer is tricky.
>
> I don't use MFC. I do know that the answer for straight Win32 (with VC
> or eVC) is to use FindFirstFile and relatives. I just used grep to
> search through the MFC source files for the Pocket PC 2003 SDK. That
> led me to a function called CFileFind::FileFind in filefind.c. But I
> could find neither CFileFind not FileFind when I used the index in
> MSDN Library.
>
> I just used google (http://groups.google.com/advanced_group_search) to
> look up
> mfc findfirstfile
> in this newsgroup (microsoft.public.pocketpc.developer) and got 2
> hits. The second was a 29-30 May 2003 thread called "Listing the
> archives of a directory".
>
> When I looked for the same strings without restricting the newsgroup,
> I got 916 hits. I didn't check any.
>
>
> >
> >Many thanks
> >
>
> -----------------------------------------
> To reply to me, remove the underscores (_) from my email address (and
> please indicate which newsgroup and message).
>
> Robert E. Zaret, eMVP
> PenFact, Inc.
> 500 Harrison Ave., Suite 3R
> Boston, MA 02118
> www.penfact.com
>