- UID
- 195957
- 帖子
- 202
- 主題
- 10
- 精華
- 0
- 積分
- 5
- 楓幣
- 1159
- 威望
- 2
- 存款
- 0
- 贊助金額
- 0
- 推廣
- 0
- GP
- 5
- 閱讀權限
- 10
- 性別
- 保密
- 在線時間
- 68 小時
- 註冊時間
- 2017-7-10
- 最後登入
- 2021-3-13
|
這個問題可能簡單 但我不會w 求指點
最近學寫VB 寫了一個自動打字的 遇到一個問題
我只能點進程式視窗才可以使用快捷鍵 沒辦法下各位寫的都能在別的視窗按快捷也會動作
以下是我的程式 環境為Visual Studio2019
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
SendKeys.Send((TextBox1.Text))
SendKeys.Send("{Enter}")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Timer1.Enabled = False
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
Timer1.Interval = TextBox2.Text
End Sub
Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.F1 Then
Button1.PerformClick()
ElseIf e.KeyCode = Keys.F2 Then
Button2.PerformClick()
End If
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.KeyPreview = True
Me.Enabled = True
End Sub
End Class
|
|