VBGood网站全文搜索 Google

首页 - 经验之谈 - 显示查找对话框
发表评论(0)作者:不详, 平台:VB6.0+Win98, 阅读:9857, 日期:2000-11-09
Displaying the Find Dialog

Do your users need to search for files?

Give them a helping hand and bring up the Find Files dialog box with this handy code snippet.

To run, just call the ShowFindDialog method, passing an optional directory to search.

Note: If you pass an invalid directory, the Find Files dialog will not appear. If you don抰 pass a directory, the 慶urrent?directory will be automatically selected.


Call ShowFindDialog("e:\karl\")

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
Const SW_SHOW = 5

Public Sub ShowFindDialog(Optional InitialDirectory As String)

ShellExecute 0, "find", _
  IIf(InitialDirectory = "", "", InitialDirectory), _
  vbNullString, vbNullString, SW_SHOW

End Sub