i want to find out how can i simulate a keydown and keyup. Like i want my program to hold on ctrl button for 5second then release it. I done this using autohotkey and it was pretty easy, but i want to make a gui for that. here is my sample code from autohotkey and i hope someone can translate this to vb.net or help me for keydown and keyup.
INSERT::
Sendinput, {LControl Down}
Sleep 2000
Sendinput, {LControl Up}
Return
in the code above, when i press the INSERT button it will hold the left control button for 2seconds then release it.
you may use the keybd_event
function:
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
You may find some references here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms646304%28v=vs.85%29.aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.