Hi Ben,
    Below is a snippet of code that allows you to retrieve file names
located in a particular directory. The first argument of the FindFirstFile
API call can either be a string that specifies a valid directory or path and
filename, which can contain wildcard characters (* and ?). In my example
below I'm searching for all the Word documents (.doc) in the c:\temp
directory. Make sure you include all the constants, type and function
declarations in your MB code and also remember to release the
FindFirstFileHandle at the end!!

Hope this helps,

Dave.

Dave Langley

Mapping Applications Consultant
Dataview Solutions Ltd
London
UK

*******************

define MAX_PATH 260

Type FILETIME
        dwLowDateTime As Integer
        dwHighDateTime As Integer
End Type

Type WIN32_FIND_DATA
        dwFileAttributes As Integer
        ftCreationTime As FILETIME
        ftLastAccessTime As FILETIME
        ftLastWriteTime As FILETIME
        nFileSizeHigh As Integer
        nFileSizeLow As Integer
        dwReserved0 As Integer
        dwReserved1 As Integer
        cFileName As String * MAX_PATH ' This is the 'long' file name of the
file
        cAlternate As String * 14 ' This name is in the classic 8.3
(filename.ext) filename format.
End Type

Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal
lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Integer
Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal
hFindFile As Integer, lpFindFileData As WIN32_FIND_DATA) As Integer
Declare Function FindClose Lib "kernel32" Alias "FindClose" (ByVal hFindFile
As Integer) As Integer

Dim FindFileData as WIN32_FIND_DATA
Dim FindFileHandle,FindCloseResult as Integer

FindFileHandle=FindFirstFile("c:\temp\*.doc",FindFileData)

do
      print FindFileData.cFileName
loop until (NOT FindNextFile(FindFileHandle,FindFileData))

FindCloseResult=FindClose(FindFileHandle) ' release the FindFileHandle

Dave Langley

Mapping Applications Consultant
Dataview Solutions Ltd
London
UK

Telephone:  +44 (0)1635 581355
Mobile:        +44 (0)973 797769

Business email: [EMAIL PROTECTED]
Personal email: [EMAIL PROTECTED]

Dataview Home Page: www.dataview-solutions.co.uk
_________________________________________________________
WARNING - THIS E-MAIL TRANSMISSION IS CONFIDENTIAL.
This e-mail transmission (including any accompanying attachments)
contains confidential information which is intended for the named
addressee only. If you are not the intended recipient, you are hereby
notified that any use, dissemination, distribution or reproduction of
this e-mail is prohibited. If you have received this e-mail in error please
contact us immediately at [EMAIL PROTECTED] Thank you.
_________________________________________________________


----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to