Is there any way to delete a locked file?
I've never tried deleting a locked file. You will want to run your program before windows starts to delete such files. But there's a VC++ example for a forcedel at codeguru.com that claims to do it. Maybe you can port it VB.
What is the best way to search a file?
Like I said, use one of these methods:
1. Use the SearchPath API
2. Use the FindFirstFile with the FindNextFile APIs
3. Use the built-in Dir() function
4. Use the Drivelistbox, Dirlistbox and Filelistbox controls to walk through each directory in every drive to find the file.
5. Use the FSO drives,folders and files collection to do the same in (4).
The best way would be to use any of the API methods as they are much faster.