Public Const MAX_PATH = 260
Public Const FILE_ATTRIBUTE_DIRECTORY = &H10Public Type FILETIME
       dwLowDateTime As Long
       dwHighDateTime As Long
End TypePublic Type WIN32_FIND_DATA
       dwFileAttributes As Long
       ftCreationTime As FILETIME
       ftLastAccessTime As FILETIME
       ftLastWriteTime As FILETIME
       nFileSizeHigh As Long
       nFileSizeLow As Long
       dwReserved0 As Long
       dwReserved1 As Long
       cFileName As String * MAX_PATH
       cAlternate As String * 14
End Type
Public Declare Function FindFirstFile Lib "kernel32" Alias _
       "FindFirstFileA" (ByVal lpFileName As String, _
       lpFindFileData As WIN32_FIND_DATA) As Long
Public Declare Function FindNextFile Lib "kernel32" Alias _
       "FindNextFileA" (ByVal hFindFile As Long, _
       lpFindFileData As WIN32_FIND_DATA) As Long
Public Declare Function FindClose Lib "kernel32" (ByVal _
       hFindFile As Long) As Long
Public Declare Function SetCurrentDirectory Lib "kernel32" Alias _
       "SetCurrentDirectoryA" (ByVal lpPathName As String) As Long
Sub AllSearch(sPath As String, sFile As String)
   Dim xf As WIN32_FIND_DATA
   Dim ff As WIN32_FIND_DATA
   Dim findhandle As Long
   Dim lFindFile As Long
   Dim astr As String
   Dim bstr As String
   
   lFindFile = FindFirstFile(sPath + "\" + sFile, ff)
   If lFindFile > 0 Then
       Do
          ' MsgBox sPath & "\" & ff.cFileName
           List1.AddItem (sPath + "\" + ff.cFileName)
       Loop Until (FindNextFile(lFindFile, ff) = 0)
       FindClose lFindFile
   End If
   
   astr = sPath + "\" + "*.*"
   findhandle = FindFirstFile(astr, xf)
   DoEvents
   Do
       If xf.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY Then
           If Asc(xf.cFileName) <> Asc(".") Then
               bstr = sPath + "\" + Left$(xf.cFileName, InStr(xf.cFileName, Chr(0)) - 1)
               AllSearch bstr, sFile
           End If
       End If
       xf.cFileName = ""
   Loop Until (FindNextFile(findhandle, xf) = 0)
   FindClose findfile
End Sub
AllSearch spath ,sfile

解决方案 »

  1.   

    这个我做过的,在工程 -〉部件 中选择 kodak开头的三个选项 把imgscan,imgedit,imgadmin添加进来 imgscan 控件事负责扫描的  用几行代码就可以了  具体的可以到网上去查 到21code.com看看
      

  2.   

    扫描后的图片要保存到另一个窗口中的Image控件中,请问如何实现?
      

  3.   

    将上面的控件填好后 写如下代码 下面的三行即将图片存入ImgEdit控件 你可以将ImgEdit控件中的图片用ImgEdit1.saveas保存到临时文件中 然后再读如Image控件
    ImgScan1.DestImageControl = "ImgEdit1"
     On Error GoTo NoDevice
    ImgScan1.StartScan
     
      
     Exit Sub
    NoDevice:
       If Err.Number = 1117 Then
          MsgBox "扫描设备没有找到,请重新安装!", vbOKOnly + vbCritical, "没有寻找到扫描设备"
          Exit Sub
          Else
          MsgBox "系统未知错误,不能继续!", vbOKOnly + vbCritical, "未知错误"
          Exit Sub
       End If
      

  4.   

    将图片存入ImgEdit控件中,再把ImgEdit控件中的图片调到另一个FROM窗口中的Image1的控件中并显示出来,望高手指教!
      

  5.   

    请问前面提到的API函数 以及kodak的imgscan控件,是否支持批量扫描? 请指点小妹,万谢!