給你個(gè)參考的例子,窗體打開(kāi)時(shí)可能大小有變化,軟件名可能有變化
創(chuàng)新互聯(lián)建站專(zhuān)業(yè)為企業(yè)提供藁城網(wǎng)站建設(shè)、藁城做網(wǎng)站、藁城網(wǎng)站設(shè)計(jì)、藁城網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、藁城企業(yè)網(wǎng)站模板建站服務(wù),十載藁城做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
先加個(gè)控件ListBox1,運(yùn)行后雙擊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 鍵順序來(lái)切換。因?yàn)榛剀?chē)往往用來(lái)確定你要按下頁(yè)面的確定按鈕。如果非要使用回車(chē):
Private Sub 文本框按下回車(chē)鍵(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
Public RunProcess As Process
RunProcess.start("djiwqjidjwqi")
AppActivate(RunProcess.Id())
網(wǎng)站名稱(chēng):vb.net焦點(diǎn)切換 vb設(shè)置焦點(diǎn)
本文路徑:http://jinyejixie.com/article2/dosdeic.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、外貿(mào)建站、網(wǎng)站排名、品牌網(wǎng)站制作、網(wǎng)站建設(shè)、建站公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)