[code]csharpcode:

/// <summary>
	/// 键盘输入模拟
	/// </summary>
	[DllImport("user32.dll", EntryPoint = "keybd_event")]
	public static extern void Keybd_event(
		  byte bvk,//虚拟键值
		  byte bScan,//0
		  int dwFlags,//0为按下,1按住,2释放
		  int dwExtraInfo//0
		  );
	float currentTime = 0;
	/// <summary>
	/// 模拟键盘按下
	/// </summary>
	private void KeyboardSimulation()
	{
		Keybd_event(17, 0, 0, 0);//Ctrl键
			Keybd_event(82, 0, 0, 0);//R键
			Keybd_event(17, 0, 2, 0);
			Keybd_event(82, 0, 2, 0);
	} 
虚拟键值查询直接搜索就可以

  

posted on 2021-10-09 19:14  陌洛  阅读(75)  评论(0编辑  收藏  举报