Ricerca - Ricerca di un file in tutto l'hard Disk Public Const MAX_PATH = 260
Declare Function SearchTreeForFile Lib "IMAGEHLP.DLL" (ByVal lpRootPath As String, ByVal lpInputName As String, ByVal lpOutputName As String) As Long Public Function FindFile(RootPath As String, FileName As String) As String Dim lNullPos As Long Dim lResult As Long Dim sBuffer As String Screen.MousePointer = 11 sBuffer = Space(MAX_PATH * 2) lResult = SearchTreeForFile(RootPath, FileName, sBuffer) Screen.MousePointer = 0 If lResult Then lNullPos = InStr(sBuffer, vbNullChar) If Not lNullPos Then sBuffer = Left(sBuffer, lNullPos - 1) End If FindFile = sBuffer Else FindFile = vbNullString End If End Function utilizzo: Private Sub Command1_Click() MsgBox FindFile("c:\", "menuextended.dll") End Sub |