【发布时间】:2017-07-04 18:09:42
【问题描述】:
我看到了关于这个问题的其他问题,但没有一个为我解决了这个问题,所以我开始了。我正在尝试向游戏发送按键以保存进度(它是 64 位游戏)。到目前为止我编码的是:
Dim p() As Process
Dim GameID As Integer = 0
Dim p As Process() = Process.GetProcessesByName("Gamename")
If p.Length > 0 Then
For i As Integer = 0 To p.Length - 1
GameID = (p(i).Id)
Next
End If
AutoSaveTimer.Enabled = True
Dim Test As Integer = 0
GetAsyncKeyState(Test)
AppActivate("GameName")
My.Computer.Keyboard.SendKeys(";", True)
现在我已经尝试过 Sendkeys.Send(";") 但没有运气,游戏在“GameName”下运行,但是按键需要在游戏下的窗口中发送: Blacked out is the game and under the first window is where the keypress needs to be sent
提前感谢您的帮助
【问题讨论】:
-
您需要将击键作为硬件扫描码发送,以便某些游戏允许它们。这样做有点“欺骗”游戏,让他们相信击键来自实际的键盘而不是程序。我在上面链接中的回答中对此进行了描述。
标签: vb.net process keyboard keypress