gpt4 book ai didi

vb.net - 如何在 Visual Basic 应用程序中打开 "Windows Search"?

转载 作者:行者123 更新时间:2023-12-05 01:09:18 25 4
gpt4 key购买 nike

如何使用 Visual Basic 打开应用程序中特定文件夹的“Windows Search Companion”或“Windows Basic Search”?

enter image description here

我找到了 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 中

enter image description here

在 Win 7

enter image description here

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 lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
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, "Find", drv, "", "", SW_SHOWNORMAL)
End Sub

关于vb.net - 如何在 Visual Basic 应用程序中打开 "Windows Search"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16032193/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com