WPF 模拟键盘输入
2013-03-26 21:32
375 查看
Method 1. SendKeys.SendWait()
Step 1.Add Reference
Then using it:
using System.Windows.Forms;
Step 2.Use it
SendKeys.SendWait("{Enter}");
Method 2.keybd_event()
Step 1. Using The Namespace:
Before using "[DllImport()]",We need add the name space :using System.Runtime.InteropServices;
Wewill need some keys enum which are defined in System.Windows.Forms.keys. And before using the namespace we have to add refrence to our object.
Then using it:
using System.Windows.Forms;
Step 2.Import Dll;
Then,import the dll:[DllImport("User32.dll")] public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo); const int KEYEVENTF_KEYDOWN = 0; const int KEYEVENTF_KEYUP = 0x2;
Step 3. Use it:
if We want to press "Enter",attention that "Keys" is not "key":keybd_event((byte)Keys.Enter, 0, KEYEVENTF_KEYDOWN, 0);
and release it:
keybd_event((byte)Keys.Enter, 0, KEYEVENTF_KEYUP, 0);
转载请注明出处:/article/5264347.html(iFinVer)
相关文章推荐
- WPF模拟键盘输入相关问题
- 文本框模拟键盘输入 WPF
- C# 模拟键盘输入
- Java中模拟鼠标和键盘输入
- windows模拟键盘输入,QT实现虚拟键盘的实现方式
- 一个C#写的模拟键盘输入的例子
- c# webBrowser 模拟键盘输入及后台执行js
- 模拟键盘输入
- Python模拟键盘输入和鼠标操作
- IOS 如何发送键盘事件,模拟键盘输入
- 通过javascript在IE模拟键盘输入
- linux 虚拟输入设备(uinput)模拟鼠标和键盘的使用方法
- 模拟键盘输入字符串的C++类
- 用Delphi模拟键盘输入
- C# webbrowser文本框的键盘和鼠标模拟输入和模拟鼠标点击
- C#程序模拟键盘输入向记事本内添加内容
- C#模拟键盘输入
- 远程控制篇:用Delphi模拟键盘输入/鼠标点击
- 使用C#模拟键盘输入、鼠标移动和点击、设置光标位置及控制应用程序的显示
- 用Delphi模拟键盘输入