加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

vb.net – 如何在Visual Basic应用程序中打开“Windows搜索”?

发布时间:2020-12-17 07:15:26 所属栏目:百科 来源:网络整理
导读:如何使用Visual Basic为应用程序中的特定文件夹打开“ Windows Search Companion”或“Windows Basic Search”? 我找到了this article,但这不是我想要的. 解决方法 像这样? VBA / VB6代码 Option Explicit'~~ API declaration for the windows "Search Res
如何使用Visual Basic为应用程序中的特定文件夹打开“ Windows Search Companion”或“Windows Basic Search”?

我找到了this article,但这不是我想要的.

解决方法

像这样?

VBA / VB6代码

Option Explicit

'~~> API declaration for the windows "Search Results" dialog
Private Declare Function ShellSearch& 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)

Private Const SW_SHOWNORMAL = 1

Const drv As String = "C:"

Sub Sample()
    ShellSearch 0,"Find",drv,"",SW_SHOWNORMAL
End Sub

在VBA中测试过

在Win XP中

在Win 7中

VB.NET(在Visual Studio Ultimate 64位上测试)

'~~> API declaration for the windows "Search Results" dialog
Private Declare Function ShellSearch Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Integer,_
ByVal nShowCmd As Integer) As Integer

Private Const SW_SHOWNORMAL = 1

Const drv As String = "C:"

Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click
    ShellSearch(0,SW_SHOWNORMAL)
End Sub

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读