سلام
کسی میدونه چه جوری میشه یه برنامه سرچ فایل و پوشه نوشت؟
راستی چطور میشه مثه تو ویندوز که در سرچ از علائم * و ؟ استفاده میکنیم، تو وی بی هم استفاده کنیم؟
Printable View
سلام
کسی میدونه چه جوری میشه یه برنامه سرچ فایل و پوشه نوشت؟
راستی چطور میشه مثه تو ویندوز که در سرچ از علائم * و ؟ استفاده میکنیم، تو وی بی هم استفاده کنیم؟
از fso و api می تونید استفاده بکنید.
از * و ؟ هم به همون شکل می شه استفاده کرد.
واقعا ممنون از این همه راهنمایی!نقل قول:
راستی شما *و؟ رو تا حالا امتحان کردی؟ چون من که امتحان کردم نشد.
این هم یه سورس برای سرچ فایل های که از api استفاده می کنه.
clsFile / colFiles (File search and File properties API classes) FAST!!!
I use these two classes to encapsulate a whole host of file oriented API calls... allowing me treat files as objects in my code and with the speed that is gained by going through the API. The clsFile class wraps around a single file, and exposes a whole host of properties of a file (and the volume it is on) including: 16 bit equivalent path, parsed filename, size, attributes (readonly, system, archive, etc), dates (created, accessed, and modified) and volume properties: label, serial no., is a cdrom, fixed disk, remote, network path, unc info, etc. (see the screen shot for the full list). Besides being a read only property class, I have modified the .Attributes enum and the .DateLastModified properties to allow changes... so that when you change the properties on the class, the corresponding properties on the file are modified. Eventually, this class could also be modified to extend functions such as Rename, Delete, Copy and Move that would work through the Windows Shell. I have the code to do this, but never bothered patching it in since in my coding, I never ran into the situation where I needed to do these actions with the file object by itself. The colFiles class acts as a collection for the clsFile class. In addition to the methods you would expect from a collection, this class also encapsulates the API functions for file searching (including recursive directory searches). If you EVER intend to use a file search in your applications, going through the API is the ONLY way to achieve this in my opinion. You'll find many examples that try to use directory list boxes to perform file scans, but these examples will be painfully slow. The API, on the other hand, is extremely fast. As fast as the built in Find/Search screen in Windows Explorer. Plus... you are able to search through paths other than your mapped drives. This covers the entire Windows Explorer directory tree (network drives, namespace extensions, etc). Don't judge this class by the screen shots before knowing that in the screen shot example, I was searching across my network which consists of a slow 10Mb hub. You'll have to try it for yourself on your set up to see why I swear by these two classes when performing seek and file property operations. For updates to this or other cool vb code or controls, check my web page:If you are not currently involved in the coding contest, I WOULD REALLY APPRECIATE YOU VOTING FOR MY CODE. Will only take a minute or two to make an account, and while it won't make me any money... =) it will encourage me to keep posting good quality code and controls like this one. (check out my other posts too). =)کد:http://members.tripod.com/thefrogprince/
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
کد:http://www.planetsourcecode.com/vb/scripts/ShowZip.asp?lngWId=1&lngCodeId=15136&strZipAccessCode=tp%2FC151363621
ین هم یکی دیگه که از api استفاده می کنه.
File & Folder Search
A program to search files and folders like the one supplied with Windows. My Windows searcher keeps failing after a few weeks so I put this one together. I used as much API as I could.
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
کد:http://www.planetsourcecode.com/vb/scripts/ShowZip.asp?lngWId=1&lngCodeId=46101&strZipAccessCode=tp%2FF461014361
این هم یکی دیگه
FilesSearch
This sub/function searches your hard drive(s) or directories for file(s) like the Windows 'Find Files or Folders...'. It uses mainly the Dir() command and can be used with any programs and visual basic I have encountered. This helps uses to quickly find a file or program for their applications.
کد:'**************************************
' Name: FilesSearch
' Description:This sub/function searches
' your hard drive(s) or directories for fi
' le(s) like the Windows 'Find Files or Fo
' lders...'. It uses mainly the Dir() comm
' and and can be used with any programs an
' d visual basic I have encountered. This
' helps uses to quickly find a file or pro
' gram for their applications.
' By: Andrew Tang
'
' Inputs:It needs two parameters, the st
' art directory or drive and the extension
' . Example: FilesSearch "C:\", "*.txt".
'
' Returns:Finds the file(s) with a parti
' cular extension from a start directory.
'
' Assumes:None that I am aware of.
'
' Side Effects:None. Slightly slower tha
' n the windows 'Find Files or Folder...'
' function.
'
'This code is copyrighted and has' limited warranties.Please see http://w
' ww.Planet-Source-Code.com/vb/scripts/Sho
' wCode.asp?txtCodeId=900&lngWId=1'for details.'**************************************
Sub FilesSearch(DrivePath As String, Ext As String)
Dim XDir() As String
Dim TmpDir As String
Dim FFound As String
Dim DirCount As Integer
Dim X As Integer
'Initialises Variables
DirCount = 0
ReDim XDir(0) As String
XDir(DirCount) = ""
If Right(DrivePath, 1) <> "\" Then
DrivePath = DrivePath & "\"
End If
'Enter here the code for showing the pat
' h being
'search. Example: Form1.label2 = DrivePa
' th
'Search for all directories and store in
' the
'XDir() variable
DoEvents
TmpDir = Dir(DrivePath, vbDirectory)
Do While TmpDir <> ""
If TmpDir <> "." And TmpDir <> ".." Then
If (GetAttr(DrivePath & TmpDir) And vbDirectory) = vbDirectory Then
XDir(DirCount) = DrivePath & TmpDir & "\"
DirCount = DirCount + 1
ReDim Preserve XDir(DirCount) As String
End If
End If
TmpDir = Dir
Loop
'Searches for the files given by extensi
' on Ext
FFound = Dir(DrivePath & Ext)
Do Until FFound = ""
'Code in here for the actions of the fil
' es found.
'Files found stored in the variable FFou
' nd.
'Example: Form1.list1.AddItem DrivePath
' & FFound
FFound = Dir
Loop
'Recursive searches through all sub dire
' ctories
For X = 0 To (UBound(XDir) - 1)
FilesSearch XDir(X), Ext
Next X
End Sub
این هم یکی دیگه که خیلی سریع هست.
FSE(Fast Search Engin)
FSE ( Fast Search Engin ) Find your files easily and fast. This program is very faster than WINDOWS SEARCH. Support WILDCARD in searching. No call API,No DLL,No OCX,No DirectoryListBox,No FileListBox. At last don 't forget to VOTE!
کد:http://www.planetsourcecode.com/vb/scripts/ShowZip.asp?lngWId=1&lngCodeId=51884&strZipAccessCode=tp%2FF518840121
شما این ها رو داونلود کن و بخون اون وقت یاد می گیری انشالله:31:
حالا بازم راهنمایی می خوای؟:31::31::31:
حالا شد یه چیزی.نقل قول:
دستت درد نکنه