Results 1 to 3 of 3

Thread: can u show me

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Location
    VIETNAM
    Posts
    209

    can u show me

    can u tell me how to find a file with specified name and copy it to a folder?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. Private Declare Function SearchTreeForFile Lib "imagehlp" (ByVal RootPath As String, ByVal InputPathName As String, ByVal OutputPathBuffer As String) As Long
    2.  
    3. Private Const MAX_PATH = 260
    4.  
    5. Private Sub Command1_Click()
    6.     Screen.MousePointer = vbHourglass
    7.     Dim tempStr As String, Ret As Long
    8.     'create a buffer string
    9.     tempStr = String(MAX_PATH, 0)
    10.     'returns 1 when successfull, 0 when failed
    11.     Ret = SearchTreeForFile("c:\", "winword.exe", tempStr)
    12.     If Ret <> 0 Then
    13.         MsgBox "Located file at " + Left$(tempStr, InStr(1, tempStr, Chr$(0)) - 1)
    14.         FileCopy tempStr, "c:\program files\winword.exe"
    15.     Else
    16.         MsgBox "File not found!"
    17.     End If
    18.     Screen.MousePointer = vbDefault
    19. End Sub

  3. #3
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    But keep in mind, since imagehlp is not part of the standard Win32 API, you'd have to include it with your project when you package it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width