Инструкция по применению программного средства
1. После запуска программы автоматически откроется форма программы (см. рис. 5);
(рис.5) 2. Для просмотра доступных файлов, необходимо выбрать интересующую пользователя папку. Это производится путём двойного нажатия на отображения папок, находящиеся в правом окне (см. рис. 5), файлы, находящиеся в папке отобразятся в левом окне;
(рис 6) 3. Для открытия файла необходимо два раза щелкнуть по нему
(рис 7) 4. Для поиска файлов необходимо ввести имя и расширение файла в строку Search Criteria и нажать кнопку Search
(рис 8)
5. После этого отобразится список найденных файлов
(рис 9) КОНТРОЛЬНЫЙ ПРИМЕР
Поиск и открытие файла на ПК разработчика
(рис 10)
(рис 11)
(рис 12)
( рис 13) ПРИЛОЖЕНИЕ
Dim SearchFlag As Integer Private Declare Function ShellExecute Lib "shell32.dll" _ Alias "ShellExecuteA" _ (ByVal hWnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long
Private Sub cmdExit_Click() If cmdExit.Caption = "E&xit" Then End Else SearchFlag = False End If End Sub
Private Sub cmdSearch_Click() Dim FirstPath As String, DirCount As Integer, NumFiles As Integer Dim result As Integer If cmdSearch.Caption = "&Reset" Then ResetSearch txtSearchSpec.SetFocus Exit Sub End If
If dirList.Path <> dirList.List(dirList.ListIndex) Then dirList.Path = dirList.List(dirList.ListIndex) Exit Sub End If
Picture2.Move 0, 0 Picture1.Visible = False Picture2.Visible = True
cmdExit.Caption = "Cancel"
filList.Pattern = txtSearchSpec.Text FirstPath = dirList.Path DirCount = dirList.ListCount
NumFiles = 0 result = DirDiver(FirstPath, DirCount, "") filList.Path = dirList.Path cmdSearch.Caption = "&Reset" cmdSearch.SetFocus cmdExit.Caption = "E&xit" End Sub
Private Function DirDiver(NewPath As String, DirCount As Integer, BackUp As String) As Integer
Static FirstErr As Integer Dim DirsToPeek As Integer, AbandonSearch As Integer, ind As Integer Dim OldPath As String, ThePath As String, entry As String Dim retval As Integer SearchFlag = True DirDiver = False retval = DoEvents() If SearchFlag = False Then DirDiver = True Exit Function End If On Local Error GoTo DirDriverHandler DirsToPeek = dirList.ListCount Do While DirsToPeek > 0 And SearchFlag = True OldPath = dirList.Path dirList.Path = NewPath If dirList.ListCount > 0 Then dirList.Path = dirList.List(DirsToPeek - 1) AbandonSearch = DirDiver((dirList.Path), DirCount%, OldPath) End If DirsToPeek = DirsToPeek - 1 If AbandonSearch = True Then Exit Function Loop
If filList.ListCount Then If Len(dirList.Path) <= 3 Then ThePath = dirList.Path Else ThePath = dirList.Path + "\" End If For ind = 0 To filList.ListCount - 1 entry = ThePath + filList.List(ind) lstFoundFiles.AddItem entry lblCount.Caption = Str(Val(lblCount.Caption) + 1) Next ind End If If BackUp <> "" Then dirList.Path = BackUp End If Exit Function DirDriverHandler: If Err = 7 Then DirDiver = True MsgBox "You've filled the list box. Abandoning search..." Exit Function Else MsgBox Error End End If End Function
Private Sub DirList_Change() filList.Path = dirList.Path End Sub
Private Sub DirList_LostFocus() dirList.Path = dirList.List(dirList.ListIndex) End Sub
Private Sub DrvList_Change() On Error GoTo DriveHandler dirList.Path = drvList.Drive Exit Sub
DriveHandler: drvList.Drive = dirList.Path Exit Sub End Sub
Private Sub filList_DblClick() ShellExecute 0, vbNullString, dirList.Path + "\" + filList.FileName, _ vbNullString, vbNullString, vbNormalFocus End Sub
Private Sub Form_Load() Picture2.Move 0, 0 Picture2.Width = WinSeek.ScaleWidth Picture2.BackColor = WinSeek.BackColor lblCount.BackColor = WinSeek.BackColor lblCriteria.BackColor = WinSeek.BackColor lblfound.BackColor = WinSeek.BackColor Picture1.Move 0, 0 Picture1.Width = WinSeek.ScaleWidth Picture1.BackColor = WinSeek.BackColor End Sub
Private Sub Form_Unload(Cancel As Integer) End End Sub
Private Sub ResetSearch() lstFoundFiles.Clear lblCount.Caption = 0 SearchFlag = False Picture2.Visible = False cmdSearch.Caption = "&Search" cmdExit.Caption = "E&xit" Picture1.Visible = True dirList.Path = CurDir: drvList.Drive = dirList.Path End Sub
Private Sub lstFoundFiles_DblClick() ShellExecute 0, vbNullString, lstFoundFiles.Text, _ vbNullString, vbNullString, vbNormalFocus End Sub
Private Sub txtSearchSpec_Change() filList.Pattern = txtSearchSpec.Text End Sub
Private Sub txtSearchSpec_GotFocus() txtSearchSpec.SelStart = 0 txtSearchSpec.SelLength = Len(txtSearchSpec.Text) End Subc
Популярное: Организация как механизм и форма жизни коллектива: Организация не сможет достичь поставленных целей без соответствующей внутренней... Модели организации как закрытой, открытой, частично открытой системы: Закрытая система имеет жесткие фиксированные границы, ее действия относительно независимы... ©2015-2024 megaobuchalka.ru Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав. (170)
|
Почему 1285321 студент выбрали МегаОбучалку... Система поиска информации Мобильная версия сайта Удобная навигация Нет шокирующей рекламы |