主题:请教:关于模拟按键的问题
我是个初学者,在用vb.net做模拟按键是遇到了这个问题:
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
keybd_event(18, 0, 0, 0)
keybd_event(115, 0, 0, 0)
keybd_event(46, 0, KEYEVENTF_KEYUP, 0)
keybd_event(115, 0, KEYEVENTF_KEYUP, 0)
上面代码可以模拟Alt+F4。
但下面代码为什么不能模拟Ctrl+Alt+Del呢?
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
keybd_event(17, 0, 0, 0)
keybd_event(18, 0, 0, 0)
keybd_event(46, 0, 0, 0)
keybd_event(46, 0, KEYEVENTF_KEYUP, 0)
keybd_event(18, 0, KEYEVENTF_KEYUP, 0)
keybd_event(17, 0, KEYEVENTF_KEYUP, 0)
还请各位高手指教啊!
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
keybd_event(18, 0, 0, 0)
keybd_event(115, 0, 0, 0)
keybd_event(46, 0, KEYEVENTF_KEYUP, 0)
keybd_event(115, 0, KEYEVENTF_KEYUP, 0)
上面代码可以模拟Alt+F4。
但下面代码为什么不能模拟Ctrl+Alt+Del呢?
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
keybd_event(17, 0, 0, 0)
keybd_event(18, 0, 0, 0)
keybd_event(46, 0, 0, 0)
keybd_event(46, 0, KEYEVENTF_KEYUP, 0)
keybd_event(18, 0, KEYEVENTF_KEYUP, 0)
keybd_event(17, 0, KEYEVENTF_KEYUP, 0)
还请各位高手指教啊!