В общем тема такая: запустил демо-код от James Moloney с сайта
http://glab2007.narod.ru/d/mu.html
на MI16 64en также не пошла, вылет MIбез слов, без попытки что-то сделать.
А вот на MI15 32en все прошло на ура.
дело может в разрядности MI? и библиотеках каких-нить WinAPI....тут я не шарю((((
вот демо-код:
'--------------------------------------------------------------------------------------------------
'***** Directory Scan Example *****
' Copyright © January 2014 - Developed James Moloney
'
'This example demonstrates how to scan the windows directory using the Windows API kernel32.dll.
'Before you compile this code modify the strDir value and the filter type in the Main sub routine.
'
'WARNING! SOME CHANGES WERE MADE TO AN ORIGINAL CODE!
'
'Please feel free to use or modify this code for use in your application. This code is offered
'under the described GNU below. It would be appreciated if this code is used that there is a
'reference back to
http://mapbasichelp.blogspot.com
'
'Kind regards
'James Moloney
'
'GNU GENERAL PUBLIC LICENSE
'This program is free software: you can redistribute it and/or modify
'it under the terms of the GNU General Public License as published by
'the Free Software Foundation, either version 3 of the License, or
'(at your option) any later version.
'This program is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'GNU General Public License for more details.
'You should have received a copy of the GNU General Public License
'along with this program. If not, see
http://www.gnu.org/licenses/
'--------------------------------------------------------------------------------------------------
Include "MAPBASIC.def"
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 * 260
cAlternate As String * 14
End Type
Define FILE_ATTRIBUTE_DIRECTORY 16
Declare Sub Main()
Declare Function GetFileList(ByVal strFilePath as String, ByVal strFileFilter as String, strFileList() as String) as Logical
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" (ByVal hFindFile As Integer) As Integer
'--------------------------------------------------------------------------------------------------
Sub Main()
OnError Goto CatchEx
Dim bResult As Logical
Dim strDir As String
Dim saFileNames() as String
Dim i as integer
Print chr$(12)
' strDir = "C:\Temp\"
strDir = LocateFile$(LOCATE_CUSTSYMB_DIR) ' Directory with users symbols
' bResult = GetFileList(strDir, ".tab" , saFileNames())
bResult = GetFileList(strDir, ".bmp" , saFileNames()) ' only *BMP files
If bResult = True Then
For i = 1 to UBound(saFileNames())
Print i & ": " & saFileNames(i)
Next
Note "Total files found: " & UBound(saFileNames())
Else
Note strDir & " Doesn't Exist"
End If
Done:
Exit Sub
CatchEx:
Note Error$()
Resume Done
End Sub
'--------------------------------------------------------------------------------------------------
Function GetFileList(ByVal strFilePath as String, ByVal strFileFilter as String, strFileList() as String) as Logical
OnError Goto CatchEx
Dim hFind As Integer
Dim wfd As WIN32_FIND_DATA
Dim strFileName as String
Dim iReturn as Integer
iReturn = 1
Dim i as Integer
i = 1
Dim strSubDirFileList() as String
Dim j as Integer
hFind = FindFirstFile(strFilePath & "*.*", wfd)
'Trim off any spaces
strFileName = LTrim$(RTrim$(wfd.cFileName))
If Len(strFileName) > 0 Then
Do While iReturn <> 0
If strFileName = "." or strFileName = ".." then
iReturn = FindNextFile(hFind, wfd)
strFileName = LTrim$(RTrim$(wfd.cFileName))
Else
strFileName = LTrim$(RTrim$(wfd.cFileName))
If wfd.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY then
iReturn = GetFileList(strFilePath & strFileName & "\", strFileFilter, strSubDirFileList())
For j = 1 to Ubound(strSubDirFileList)
ReDim strFileList(i)
strFileList(i) = strSubDirFileList(j)
i = i + 1
Next
iReturn = FindNextFile(hFind, wfd)
Else
If Right$(strFileName, Len(strFileFilter)) = strFileFilter then
ReDim strFileList(i)
strFileList(i)= strFilePath & strFileName
i = i + 1
End If
iReturn = FindNextFile(hFind, wfd)
End If
End If
Loop
End If
iReturn = FindClose(hFind)
GetFileList = true
Done:
Exit Sub
CatchEx:
Note Error$()
Resume Done
End Function
'--------------------------------------------------------------------------------------------------