VB,alt键按下状态。
OptionExplicitPrivateDeclareSubkeybd_eventLib"user32"(ByValbVkAsByte,ByValbScanAsByte...
Option Explicit
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
keybd_event Asc("A"), 0, 0, 0
keybd_event Asc("A"), 0, KEYEVENTF_KEYUP, 0
End Sub
以上是以为朋友给出的代码,他帮我实现了按下字母键的问题,可并不能实现alt,ctrl 一些键的按下状态,请问 要如何实现呢?是始终的按下状态 例如,有一check选项空间,当打钩时,ctrl为启动状态,我在textbox控件按下a键时,能全选文本。。。。谢谢各位了!!! 展开
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
keybd_event Asc("A"), 0, 0, 0
keybd_event Asc("A"), 0, KEYEVENTF_KEYUP, 0
End Sub
以上是以为朋友给出的代码,他帮我实现了按下字母键的问题,可并不能实现alt,ctrl 一些键的按下状态,请问 要如何实现呢?是始终的按下状态 例如,有一check选项空间,当打钩时,ctrl为启动状态,我在textbox控件按下a键时,能全选文本。。。。谢谢各位了!!! 展开
展开全部
Call keybd_event(17, 0, 0, 0) '模拟ctrl 按下
Call keybd_event(17, 0, &H2, 0) '模拟ctrl弹起
Shift 16
Control 17
Alt 18
全选文本不如直接添加个按钮
Private Sub Command1_Click()
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Call keybd_event(17, 0, &H2, 0) '模拟ctrl弹起
Shift 16
Control 17
Alt 18
全选文本不如直接添加个按钮
Private Sub Command1_Click()
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询