本文介绍了API FindFirstFile \FindNextFile与GetFiles的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 大家好, 我正在开发一个程序,需要搜索多个文件类型的多个驱动器 并根据某些地理空间对它们进行编目属性。总之,驱动器上有数十万个文件。作为该过程的一部分,我目前正在使用 FileSystem对象的GetFiles方法来检索字符串集合 表示特定文件类型的集合(用于例如,tif文件)。问题 是GetFiles方法似乎没有做任何回调让我能够显示某种有意义的进展,并且这个过程可以采取很长一段时间。我知道 我可以用一个字幕样式进度条和一个忙碌的鼠标图标来捏造它,但是这个 并不理想。 因此,我正在考虑使用API来完成繁重的工作。这将允许我在执行搜索时至少显示标签控件中的每个文件名。。我是 尝试在他的网站上输入Randy Birch的VB6代码 http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm 。除了我已经声明的FindNextFile函数之外,它有点工作 : ///// 私有声明函数FindNextFile Lib" kernel32" _ Alias" FindNextFileA" _ (ByVal hFindFile As Int32,_ ByVal lpFindFileData As WIN32_FIND_DATA)作为IntPtr ///// 如当前实现的那样,该函数不会将搜索移动到下一个文件。它总是返回目录中的第一个文件并且它正确地返回该 文件的所有属性。 它返回第一个文件的次数与 目录中的文件一样多。我在想它是因为WIN32_FIND_DATA--它是VB6中的一个UDT 代码 - 被定义为我的代码中的一个对象而Dim''d ///// Dim WFD As WIN32_FIND_DATA = New WIN32_FIND_DATA ///// 在SearchForFiles Sub的开头。作为参考,我的代码WIN32_FIND_DATA 定义如下: ///// < StructLayout(LayoutKind。顺序,_ CharSet:= CharSet.Auto)_ 朋友类WIN32_FIND_DATA 朋友sfileAttributes为Int32 = 0 朋友creationTime_lowDateTime As Int32 = 0 朋友creationTime_highDateTime As Int32 = 0 朋友lastAccessTime_lowDateTime As Int32 = 0 朋友lastAccessTime_highDateTime As Int32 = 0 朋友lastWriteTime_lowDateTime为Int32 = 0 朋友lastWriteTime_highDateTime为Int32 = 0 朋友nFileSizeHigh为Int32 = 0 朋友nFileSizeLow因为Int32 = 0 朋友dwReserved0因为Int32 = 0 朋友dwReserved1因为Int32 = 0 < MarshalAs(UnmanagedType.ByValTStr, SizeConst:= MAX_PATH)_ 朋友fileName As String = Nothing < MarshalAs(UnmanagedType.ByValTStr,SizeConst:= 14)_ 朋友替代eFileName As String = Nothing End Class ///// 如何实现FindNextFile调用转到 目录中的下一个文件? Lance 解决方案 到底是什么?我没有将WIN32_FIND_DATA定义为对象。这是一个结构。 符合我的理论。呃,今天早上咖啡不够。我仍然对你的 想法为什么FindNextFile API函数无法正常工作感兴趣。 Lance " Lance" < nu *** @ business.comwrote in message news:%2 **************** @ TK2MSFTNGP03.phx.gbl ... 大家好, 我正在开发一个需要为多种文件类型搜索多个驱动器的程序 并根据某些地理空间属性对它们进行编目。总之,驱动器上有数十万个文件。作为整个过程的一部分,我现在使用FileSystem对象的GetFiles方法来检索字符串集合 表示特定文件类型的集合(对于例如,tif文件)。 问题是,GetFiles方法似乎没有做出任何允许我显示某种有意义的进展的回调,并且该过程可以采取很长的时间。时间。我知道我可以用一个大字幕式的进度条和一个忙碌的鼠标来捏造它。\\ n \\ n 图标,但这并不理想。 所以,我正在考虑使用API来完成繁重的工作。这将允许我在执行搜索时至少显示标签控件中的每个文件名。。我是 尝试在他的网站上输入Randy Birch的VB6代码 http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm 。除了我已经声明的FindNextFile函数之外,它有点工作 : ///// 私有声明函数FindNextFile Lib" kernel32" _ Alias" FindNextFileA" _ (ByVal hFindFile As Int32,_ ByVal lpFindFileData As WIN32_FIND_DATA)作为IntPtr ///// 如当前实现的那样,该函数不会将搜索移动到下一个文件。它是 总是返回目录中的第一个文件,它返回正确文件的所有属性 。并且它返回第一个文件的次数与目录中的 文件一样多。我在想它是因为WIN32_FIND_DATA--这是VB6代码中的一个UDT - 在我的代码中被定义为一个对象而Dim''d为 ///// Dim WFD As WIN32_FIND_DATA = New WIN32_FIND_DATA ///// 在SearchForFiles Sub的开头。作为参考,我的代码WIN32_FIND_DATA 定义如下: ///// < StructLayout(LayoutKind。顺序,_ CharSet:= CharSet.Auto)_ 朋友类WIN32_FIND_DATA 朋友sfileAttributes为Int32 = 0 朋友creationTime_lowDateTime As Int32 = 0 朋友creationTime_highDateTime As Int32 = 0 朋友lastAccessTime_lowDateTime As Int32 = 0 朋友lastAccessTime_highDateTime As Int32 = 0 朋友lastWriteTime_lowDateTime为Int32 = 0 朋友lastWriteTime_highDateTime为Int32 = 0 朋友nFileSizeHigh为Int32 = 0 朋友nFileSizeLow因为Int32 = 0 朋友dwReserved0因为Int32 = 0 朋友dwReserved1因为Int32 = 0 < MarshalAs(UnmanagedType.ByValTStr, SizeConst:= MAX_PATH)_ 朋友fileName As String = Nothing < MarshalAs(UnmanagedType.ByValTStr,SizeConst:= 14)_ 朋友候补FileName As String = Nothing End Class ///// 如何实现FindNextFile调用转到 目录中的下一个文件? Lance 您可以通过BackgroundWorker调用GetFiles方法。在你的get 文件方法中,你可以调用BackgroundWorker ReportProgress方法每个 找到/处理文件的时间和BackgoundWorker的处理程序 ProgressChanged事件这将引发你可以使用文件名更新标签控件 。 对于提供使用源代码的免费Visual Studio 2005解决方案 BackgroundWorker类访问 - > http://www.getdotnetcode.com/GdncSto...orkerClass.htm - Mike Mike McIntyre [MVP] http:// www .getdotnetcode.com " Lance" < nu *** @ business.comwrote in message news:%2 **************** @ TK2MSFTNGP03.phx.gbl ... 大家好, 我正在开发一个需要搜索多个驱动器的程序 多种文件类型,并根据某些地理空间 属性对其进行编目。总之, 驱动器上有数十万个文件。作为该过程的一部分,我目前正在使用FileSystem对象的GetFiles方法 来检索表示特定文件类型的 集合的字符串集合(for例如,tif文件)。 问题是GetFiles方法似乎没有做任何回调 ,这将允许我展示某种有意义的进展,并且 过程可能需要很长时间。我知道我可以用一个字幕 风格的进度条和一个忙碌的鼠标图标来捏造它,但这并不理想。 所以,我正在考虑使用API来完成繁重的工作。这将 允许我至少显示标签控件中的每个文件名,因为正在执行 搜索。我正试图在他的网站上输入Randy Birch的VB6代码 http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm 。 It我的工作有点不同,除了FindNextFile函数我已经声明了这样的: ///// 私有声明函数FindNextFile Lib" kernel32" _ Alias" FindNextFileA" _ (ByVal hFindFile As Int32,_ ByVal lpFindFileData As WIN32_FIND_DATA)作为IntPtr ///// 按照目前的实现,该功能不会将搜索移动到 下一个文件。它始终返回目录中的第一个文件,并且它会正确返回该文件的所有属性。并且它返回此 第一个文件的次数与目录中的文件一样多。我认为这是因为WIN32_FIND_DATA - 这是VB6中的UDT 代码 - 被定义为我的代码中的一个对象而Dim'' d as ///// Dim WFD As WIN32_FIND_DATA = New WIN32_FIND_DATA ///// 在SearchForFiles Sub开头的。作为参考,在我的代码中 WIN32_FIND_DATA定义如下: ///// < StructLayout(LayoutKind。顺序,_ CharSet:= CharSet.Auto)_ 朋友类WIN32_FIND_DATA 朋友sfileAttributes为Int32 = 0 朋友creationTime_lowDateTime As Int32 = 0 朋友creationTime_highDateTime As Int32 = 0 朋友lastAccessTime_lowDateTime As Int32 = 0 朋友lastAccessTime_highDateTime As Int32 = 0 朋友lastWriteTime_lowDateTime为Int32 = 0 朋友lastWriteTime_highDateTime为Int32 = 0 朋友nFileSizeHigh为Int32 = 0 朋友nFileSizeLow因为Int32 = 0 朋友dwReserved0因为Int32 = 0 朋友dwReserved1因为Int32 = 0 < MarshalAs(UnmanagedType.ByValTStr, SizeConst:= MAX_PATH)_ 朋友fileName As String = Nothing < MarshalAs(UnmanagedType.ByValTStr,SizeConst:= 14)_ 朋友候补FileName As String = Nothing End Class ///// 如何实现FindNextFile调用转到目录中的下一个 文件? Lance 我考虑过这一点但是假设GetFiles方法仍然没有向BackWorkWork报告任何进展 。不可否认,对于BackgroundWorker 如何接收消息,我有点朦胧。我的理解是,如果GetFiles方法没有做回回调,那么它就没有回调。 另一件事但是,对于API方法很有吸引力的是,我可以一次搜索多个文件类型的。 GetFiles似乎一次只限于一种类型。我会 正在搜索和编目十几种不同的文件类型 Lance " Mike McIntyre" ; < mi **** @ getdotnetcode.comWrote in message news:eE ************* @ TK2MSFTNGP05.phx.gbl ... 您可以通过BackgroundWorker调用GetFiles方法。在你的get files方法中,每当一个文件找到/处理了时,你就可以调用BackgroundWorker ReportProgress方法,并且在BackgoundWorker ProgressChanged事件的处理程序中,这将是 加注你可以用文件名更新标签控件。 对于免费的Visual Studio 2005解决方案,提供使用 的源代码BackgroundWorker课程访问 - > http:// www.getdotnetcode.com/GdncSto...orkerClass.htm - Mike Mike McIntyre [MVP] http://www.getdotnetcode.com " Lance" < nu *** @ business.comwrote in message news:%2 **************** @ TK2MSFTNGP03.phx.gbl ... >大家好, 我正在开发一个程序,需要搜索多个文件的多个驱动器类型和根据某些地理空间属性对它们进行编目。总之,驱动器上有数十万个文件。作为该过程的一部分,我现在正在使用FileSystem对象的GetFiles方法来检索表示特定文件类型集合的字符串集合(例如,tif文件)。问题是GetFiles方法似乎没有做任何回调,这会让我显示出某种有意义的进展,而且这个过程可能需要很长时间。我知道我可以用一个字幕样式进度条和一个忙碌的鼠标图标来捏造它,但这并不理想。 所以,我正在研究使用API做咕噜咕噜的工作。这将允许我在执行搜索时至少显示标签控件中的每个文件名。我试图在他的网站上找到Randy Birch的VB6代码 http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm 。它有点工作,除了我已经声明的FindNextFile函数: ///// 私有声明函数FindNextFile Lib" kernel32" ; _ Alias" FindNextFileA" _ (ByVal hFindFile As Int32,_ ByVal lpFindFileData As WIN32_FIND_DATA)作为IntPtr ///// 目前已实现,该功能未移动搜索下一个文件。它始终返回目录中的第一个文件,并正确返回该文件的所有属性。并且它返回第一个文件的次数与目录中的文件一样多。我在想它是因为WIN32_FIND_DATA--这是VB6代码中的一个UDT - 在我的代码中被定义为一个对象,并且被暗淡为 // /// Dim WFD As WIN32_FIND_DATA =新的WIN32_FIND_DATA ///// 在SearchForFiles Sub的开头。作为参考,我的代码WIN32_FIND_DATA 定义如下: ///// < StructLayout(LayoutKind.Sequential,_ CharSet:= CharSet。自动)_ 朋友类WIN32_FIND_DATA 朋友sfileAttributes为Int32 = 0 朋友creationTime_lowDateTime为Int32 = 0 朋友creationTime_highDateTime为Int32 = 0 朋友lastAccessTime_lowDateTime为Int32 = 0 朋友lastAccessTime_highDateTime为Int32 = 0 朋友lastWriteTime_lowDateTime为Int32 = 0 朋友lastWriteTime_highDateTime为Int32 = 0 朋友nFileSizeHigh为Int32 = 0 朋友nFileSizeLow为Int32 = 0 朋友dwReserved0因为Int32 = 0 朋友dwReserved1因为Int32 = 0 < MarshalAs(UnmanagedType.ByValTStr,SizeConst:= MAX_PATH)_ 朋友fileName As String = Nothing < MarshalAsAs(UnmanagedType.ByValTStr,SizeConst:= 14)_ 朋友alternateFileName As String = Nothing End Class ///// 如何我可以这样做,所以FindNextFile调用实际上是mo继续浏览目录中的下一个文件? Lance Hi All, I''m working on a program that requires searching multiple drives for multiple file typesand cataloging them based on certain geospatial attributes. All together, there arehundreds of thousands of files on the drives. As part of the process, I''m currently usingthe GetFiles method of the FileSystem object to retrieve collection of stringsrepresenting a collection of a particular file type (for example, tif files). The problemis that the GetFiles method doesn''t seem to make any callbacks that would allow for me toshow some sort of meaningful progress, and the process can take a very long time. I knowI could fudge it with a marquee style progress bar and\or a busy mouse icon, but thisisn''t ideal. So, I was looking into using the API to do the grunt work. This would allow me to atleast display each filename in a label control as the search is being performed. I''mtrying to port Randy Birch''s VB6 code available on his website at http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm . It''s workingsomewhat, except for the FindNextFile function which I''ve declared like so: /////Private Declare Function FindNextFile Lib "kernel32" _Alias "FindNextFileA" _(ByVal hFindFile As Int32, _ByVal lpFindFileData As WIN32_FIND_DATA) As IntPtr///// As currently implemented, the function is not moving the search to the next file. It isalways returning the first file in the directory and it returns all the properties of thatfile correctly. And it returns this first file for as many times as there are files inthe directory. I''m thinking it''s because the WIN32_FIND_DATA - which is a UDT in the VB6code - is defined as an object in my code and Dim''d as /////Dim WFD As WIN32_FIND_DATA = New WIN32_FIND_DATA///// at the beginning of the SearchForFiles Sub. For reference, in my code WIN32_FIND_DATAdefined like so: /////<StructLayout(LayoutKind.Sequential, _CharSet:=CharSet.Auto)_Friend Class WIN32_FIND_DATAFriend sfileAttributes As Int32 = 0Friend creationTime_lowDateTime As Int32 = 0Friend creationTime_highDateTime As Int32 = 0Friend lastAccessTime_lowDateTime As Int32 = 0Friend lastAccessTime_highDateTime As Int32 = 0Friend lastWriteTime_lowDateTime As Int32 = 0Friend lastWriteTime_highDateTime As Int32 = 0Friend nFileSizeHigh As Int32 = 0Friend nFileSizeLow As Int32 = 0Friend dwReserved0 As Int32 = 0Friend dwReserved1 As Int32 = 0<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=MAX_PATH)_Friend fileName As String = Nothing<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=14)_Friend alternateFileName As String = NothingEnd Class///// How can I make it so the FindNextFile call actually moves on to the next file in thedirectory? Lance 解决方案 what the heck? I didn''t define WIN32_FIND_DATA as an object. It''s a structure. Theregoes my theory. Ugh, not enough coffee this morning. I''d still be interested in yourthoughts as to why the FindNextFile API function isn''t working correctly. Lance "Lance" <nu***@business.comwrote in messagenews:%2****************@TK2MSFTNGP03.phx.gbl...Hi All,I''m working on a program that requires searching multiple drives for multiple file typesand cataloging them based on certain geospatial attributes. All together, there arehundreds of thousands of files on the drives. As part of the process, I''m currentlyusing the GetFiles method of the FileSystem object to retrieve collection of stringsrepresenting a collection of a particular file type (for example, tif files). Theproblem is that the GetFiles method doesn''t seem to make any callbacks that would allowfor me to show some sort of meaningful progress, and the process can take a very longtime. I know I could fudge it with a marquee style progress bar and\or a busy mouseicon, but this isn''t ideal.So, I was looking into using the API to do the grunt work. This would allow me to atleast display each filename in a label control as the search is being performed. I''mtrying to port Randy Birch''s VB6 code available on his website at http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm . It''s workingsomewhat, except for the FindNextFile function which I''ve declared like so://///Private Declare Function FindNextFile Lib "kernel32" _Alias "FindNextFileA" _(ByVal hFindFile As Int32, _ByVal lpFindFileData As WIN32_FIND_DATA) As IntPtr/////As currently implemented, the function is not moving the search to the next file. It isalways returning the first file in the directory and it returns all the properties ofthat file correctly. And it returns this first file for as many times as there arefiles in the directory. I''m thinking it''s because the WIN32_FIND_DATA - which is a UDTin the VB6 code - is defined as an object in my code and Dim''d as/////Dim WFD As WIN32_FIND_DATA = New WIN32_FIND_DATA/////at the beginning of the SearchForFiles Sub. For reference, in my code WIN32_FIND_DATAdefined like so://///<StructLayout(LayoutKind.Sequential, _CharSet:=CharSet.Auto)_Friend Class WIN32_FIND_DATAFriend sfileAttributes As Int32 = 0Friend creationTime_lowDateTime As Int32 = 0Friend creationTime_highDateTime As Int32 = 0Friend lastAccessTime_lowDateTime As Int32 = 0Friend lastAccessTime_highDateTime As Int32 = 0Friend lastWriteTime_lowDateTime As Int32 = 0Friend lastWriteTime_highDateTime As Int32 = 0Friend nFileSizeHigh As Int32 = 0Friend nFileSizeLow As Int32 = 0Friend dwReserved0 As Int32 = 0Friend dwReserved1 As Int32 = 0<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=MAX_PATH)_Friend fileName As String = Nothing<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=14)_Friend alternateFileName As String = NothingEnd Class/////How can I make it so the FindNextFile call actually moves on to the next file in thedirectory?Lance You could call the GetFiles method via a BackgroundWorker. In your getfiles method you could call the BackgroundWorker ReportProgress method eachtime a file is found/processed and in a handler for the BackgoundWorkerProgressChanged event this will raise you could update the label controlwith the filename. For a free Visual Studio 2005 solution that provides source code for usingthe BackgroundWorker class visit -> http://www.getdotnetcode.com/GdncSto...orkerClass.htm --Mike Mike McIntyre [MVP] http://www.getdotnetcode.com"Lance" <nu***@business.comwrote in messagenews:%2****************@TK2MSFTNGP03.phx.gbl...Hi All,I''m working on a program that requires searching multiple drives formultiple file types and cataloging them based on certain geospatialattributes. All together, there are hundreds of thousands of files on thedrives. As part of the process, I''m currently using the GetFiles methodof the FileSystem object to retrieve collection of strings representing acollection of a particular file type (for example, tif files). Theproblem is that the GetFiles method doesn''t seem to make any callbacksthat would allow for me to show some sort of meaningful progress, and theprocess can take a very long time. I know I could fudge it with a marqueestyle progress bar and\or a busy mouse icon, but this isn''t ideal.So, I was looking into using the API to do the grunt work. This wouldallow me to at least display each filename in a label control as thesearch is being performed. I''m trying to port Randy Birch''s VB6 codeavailable on his website at http://vbnet.mvps.org/code/fileapi/r...l_multiple.htm .It''s working somewhat, except for the FindNextFile function which I''vedeclared like so://///Private Declare Function FindNextFile Lib "kernel32" _Alias "FindNextFileA" _(ByVal hFindFile As Int32, _ByVal lpFindFileData As WIN32_FIND_DATA) As IntPtr/////As currently implemented, the function is not moving the search to thenext file. It is always returning the first file in the directory and itreturns all the properties of that file correctly. And it returns thisfirst file for as many times as there are files in the directory. I''mthinking it''s because the WIN32_FIND_DATA - which is a UDT in the VB6code - is defined as an object in my code and Dim''d as/////Dim WFD As WIN32_FIND_DATA = New WIN32_FIND_DATA/////at the beginning of the SearchForFiles Sub. For reference, in my codeWIN32_FIND_DATA defined like so://///<StructLayout(LayoutKind.Sequential, _CharSet:=CharSet.Auto)_Friend Class WIN32_FIND_DATAFriend sfileAttributes As Int32 = 0Friend creationTime_lowDateTime As Int32 = 0Friend creationTime_highDateTime As Int32 = 0Friend lastAccessTime_lowDateTime As Int32 = 0Friend lastAccessTime_highDateTime As Int32 = 0Friend lastWriteTime_lowDateTime As Int32 = 0Friend lastWriteTime_highDateTime As Int32 = 0Friend nFileSizeHigh As Int32 = 0Friend nFileSizeLow As Int32 = 0Friend dwReserved0 As Int32 = 0Friend dwReserved1 As Int32 = 0<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=MAX_PATH)_Friend fileName As String = Nothing<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=14)_Friend alternateFileName As String = NothingEnd Class/////How can I make it so the FindNextFile call actually moves on to the nextfile in the directory?Lance I thought about that but assumed the GetFiles method would still not report any progressback to the BackgroundWorker. Admittedly, I''m a little hazy on how the BackgroundWorkerreceives messages anyway. It was my understanding that if the GetFiles method didn''t makecallbacks, then well, it didn''t make callbacks. Another thing that is attractive about the API method, though, is that I can search formultiple file types at once. GetFiles seems to be limited to one type at a time. I wouldbe searching for and cataloging about a dozen different file types Lance "Mike McIntyre" <mi****@getdotnetcode.comwrote in messagenews:eE*************@TK2MSFTNGP05.phx.gbl...You could call the GetFiles method via a BackgroundWorker. In your get files method youcould call the BackgroundWorker ReportProgress method each time a file isfound/processed and in a handler for the BackgoundWorker ProgressChanged event this willraise you could update the label control with the filename.For a free Visual Studio 2005 solution that provides source code for using theBackgroundWorker class visit -> http://www.getdotnetcode.com/GdncSto...orkerClass.htm--MikeMike McIntyre [MVP] http://www.getdotnetcode.com"Lance" <nu***@business.comwrote in messagenews:%2****************@TK2MSFTNGP03.phx.gbl...>Hi All,I''m working on a program that requires searching multiple drives for multiple filetypes and cataloging them based on certain geospatial attributes. All together, thereare hundreds of thousands of files on the drives. As part of the process, I''mcurrently using the GetFiles method of the FileSystem object to retrieve collection ofstrings representing a collection of a particular file type (for example, tif files).The problem is that the GetFiles method doesn''t seem to make any callbacks that wouldallow for me to show some sort of meaningful progress, and the process can take a verylong time. I know I could fudge it with a marquee style progress bar and\or a busymouse icon, but this isn''t ideal.So, I was looking into using the API to do the grunt work. This would allow me to atleast display each filename in a label control as the search is being performed. I''mtrying to port Randy Birch''s VB6 code available on his website athttp://vbnet.mvps.org/code/fileapi/r...l_multiple.htm . It''s workingsomewhat, except for the FindNextFile function which I''ve declared like so://///Private Declare Function FindNextFile Lib "kernel32" _Alias "FindNextFileA" _(ByVal hFindFile As Int32, _ByVal lpFindFileData As WIN32_FIND_DATA) As IntPtr/////As currently implemented, the function is not moving the search to the next file. Itis always returning the first file in the directory and it returns all the propertiesof that file correctly. And it returns this first file for as many times as there arefiles in the directory. I''m thinking it''s because the WIN32_FIND_DATA - which is aUDT in the VB6 code - is defined as an object in my code and Dim''d as/////Dim WFD As WIN32_FIND_DATA = New WIN32_FIND_DATA/////at the beginning of the SearchForFiles Sub. For reference, in my code WIN32_FIND_DATAdefined like so://///<StructLayout(LayoutKind.Sequential, _CharSet:=CharSet.Auto)_Friend Class WIN32_FIND_DATAFriend sfileAttributes As Int32 = 0Friend creationTime_lowDateTime As Int32 = 0Friend creationTime_highDateTime As Int32 = 0Friend lastAccessTime_lowDateTime As Int32 = 0Friend lastAccessTime_highDateTime As Int32 = 0Friend lastWriteTime_lowDateTime As Int32 = 0Friend lastWriteTime_highDateTime As Int32 = 0Friend nFileSizeHigh As Int32 = 0Friend nFileSizeLow As Int32 = 0Friend dwReserved0 As Int32 = 0Friend dwReserved1 As Int32 = 0<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=MAX_PATH)_Friend fileName As String = Nothing<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=14)_Friend alternateFileName As String = NothingEnd Class/////How can I make it so the FindNextFile call actually moves on to the next file in thedirectory?Lance 这篇关于API FindFirstFile \FindNextFile与GetFiles的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-26 18:45