Public RunProcess As Process
創(chuàng)新互聯(lián)公司是一家專業(yè)提供寶清企業(yè)網(wǎng)站建設(shè),專注與網(wǎng)站設(shè)計、成都做網(wǎng)站、H5開發(fā)、小程序制作等業(yè)務(wù)。10年已為寶清眾多企業(yè)、政府機構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)的建站公司優(yōu)惠進行中。
RunProcess.start("djiwqjidjwqi")
AppActivate(RunProcess.Id())
給你個參考的例子,窗體打開時可能大小有變化,軟件名可能有變化
先加個控件ListBox1,運行后雙擊ListBox1上程序名
Public Class Form1
Public myProcess() As Process
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myProcesses() As Process = Process.GetProcesses()
Dim jh As New ArrayList
For Each bs As Process In myProcesses
If CInt(bs.MainWindowHandle) 0 Then
ListBox1.Items.Add(bs.ProcessName)
jh.Add(bs)
End If
Next
ReDim myProcess(jh.Count - 1)
jh.CopyTo(myProcess)
End Sub
Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Integer, ByVal nCmdShow As Long) As Integer
Private Sub ListBox1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDoubleClick
Dim a As Process = myProcess(ListBox1.SelectedIndex)
Try
Dim dd = ShowWindow(a.MainWindowHandle, H1)
AppActivate(a.Id)
Catch ex As Exception
End Try
End Sub
End Class
這樣不好,應(yīng)該使用 Table 鍵,按照 Table 鍵順序來切換。因為回車往往用來確定你要按下頁面的確定按鈕。如果非要使用回車:
Private Sub 文本框按下回車鍵(sender As Object, e As KeyEventArgs) Handles TextBox3.KeyDown, TextBox2.KeyDown, TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
Select Case sender.name
Case "TextBox1"
TextBox2.Focus()
Case "TextBox2"
TextBox3.Focus()
Case "TextBox3"
TextBox1.Focus()
End Select
End If
End Sub