CN103605430A - Method and device for simulating keyboard input - Google Patents

Method and device for simulating keyboard input Download PDF

Info

Publication number
CN103605430A
CN103605430A CN201310642546.2A CN201310642546A CN103605430A CN 103605430 A CN103605430 A CN 103605430A CN 201310642546 A CN201310642546 A CN 201310642546A CN 103605430 A CN103605430 A CN 103605430A
Authority
CN
China
Prior art keywords
button
simulation
keyboard
dummy keyboard
user command
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201310642546.2A
Other languages
Chinese (zh)
Inventor
曾理
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Rapoo Technology Co Ltd
Original Assignee
Shenzhen Rapoo Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Rapoo Technology Co Ltd filed Critical Shenzhen Rapoo Technology Co Ltd
Priority to CN201310642546.2A priority Critical patent/CN103605430A/en
Publication of CN103605430A publication Critical patent/CN103605430A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Input From Keyboards Or The Like (AREA)

Abstract

The invention belongs to the technical field of computers, and particularly relates to a method and device for simulating a keyboard by software. The method comprises the steps of establishing a virtual keyboard in an operating system kernel, establishing a communication interface between the virtual keyboard and a user layer, establishing the corresponding relation of user commands and virtual keyboard keys on the user layer, monitoring whether the user commands reach or not, and if yes, triggering the virtual keyboard keys corresponding to the user commands according to the corresponding relation. According to the method and device for simulating the keyboard by the software, the virtual keyboard is established on an operating system kernel level, and a kernel drive technology is used so that simulated key click information can not be shielded easily by application software. The software in the method is high in compatibility.

Description

A kind of method of Simulation of keyboard input and device
Technical field
The invention belongs to field of computer technology, relate in particular to a kind of method and device of Simulation of keyboard input.
Background technology
In recent years, people are more and more to the demand of office, game robotization, for example, in software test industry, tester often need to software repeat in a large number, shirtsleeve operation, such as input command, input network address etc., if can make to input robotization, testing efficiency will improve greatly.Answer this demand, the software that has occurred a lot of offices, game robotization on market, the ultimate principle great majority of this class software are based on some dummy keyboards, or use Hook Technique, with corresponding instruction, control virtual unit and complete a series of action, only need a simple action can complete the operation of a lot of complexity, thus the object that reaches liberation both hands, raises the efficiency.
The dummy keyboard that major part realizes by Hook Technique at present, its principle is HHOOK WINAPI SetWindowsHookEx/ (the int idHook by system definition, HOOKPROC lpfn, HINSTANCE hMod, DWORD dwThreadId) function, a dynamic link library file is registered in system interface, when having Keyboard Message to produce, system will be called in dynamic link library the call back function by the appointment of lpfn parameter, program is by the message screening in call back function, system being transmitted, oneself regenerate a keystroke message and continue to transmit along hook chain, or the keystroke message that directly modification system is transmitted.The mainstream technology that another kind is realized dummy keyboard is VOID WINAPI keybd_event (BYTE bVk, BYTE bScan, DWORD dwFlags, the ULONG_PTR dwExtraInfo) function by system definition, initiatively sends keyboard keystroke message.
These methods are all carried out under operating system user class, and the keystroke message of its simulation is easily by a lot of software maskings, and the software compatibility is not strong.
Summary of the invention
Given this, the invention provides a kind of method and device of Simulation of keyboard input, the keystroke message of the method simulation is difficult for being employed software masking, makes the software compatibility of the method strong.
Technical scheme of the present invention:
A method for Simulation of keyboard input, comprising:
The button of definition wish simulation, the button according to described wish simulation creates dummy keyboard in operating system nucleus;
For described dummy keyboard load driver, set up the communication interface between described dummy keyboard and client layer;
At described client layer, set up the corresponding relation of user command and dummy keyboard button;
Monitor and whether have user command to arrive, if had, according to described corresponding relation, trigger dummy keyboard button corresponding to described user command; Otherwise whether continue to monitor has user command to arrive.
Further, described button is multimedia function button.
Further, the button that described button is common keyboard.
Further, the mode of the button of described definition wish simulation is for passing through HID descriptor definition.
A device for Simulation of keyboard input, comprising:
Dummy keyboard creating unit, for defining the button of wish simulation, the button according to described wish simulation creates dummy keyboard in operating system nucleus;
Communication interface is set up unit, is used to described dummy keyboard load driver, sets up the communication interface between described dummy keyboard and client layer;
The corresponding relation of user command and dummy keyboard button is set up unit, for set up the corresponding relation of user command and dummy keyboard button at described client layer;
Whether user command monitoring unit, have user command to arrive for monitoring, if had, according to described corresponding relation, triggers dummy keyboard button corresponding to described user command; Otherwise whether continue to monitor has user command to arrive.
Further, described button is multimedia function button.
Further, the button that described button is common keyboard.
Further, the mode of the button of described definition wish simulation is for passing through HID descriptor definition.
Beneficial effect of the present invention:
Method of the present invention comprises: in operating system nucleus, create dummy keyboard; Set up the communication interface between described dummy keyboard and client layer; At described client layer, set up the corresponding relation of user command and dummy keyboard button; Monitor and whether have user command to arrive, if had, according to described corresponding relation, trigger dummy keyboard button corresponding to described user command.The present invention is created in operating system kernel level by dummy keyboard, adopts kernel-driven technology, makes the keystroke message of simulation be difficult for being employed software masking, and the software compatibility of method of the present invention is strong.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of a kind of method with software simulation keyboard of the present invention.
Fig. 2 is the block diagram of a kind of device with software simulation keyboard of the present invention.
Embodiment
In order to be illustrated more clearly in technical scheme of the present invention, below in conjunction with accompanying drawing and by embodiment, further illustrate technical scheme of the present invention.
Referring to Fig. 1, a kind of method with software simulation keyboard, comprising:
The button of S101, the simulation of definition wish, the button according to described wish simulation creates dummy keyboard in operating system nucleus;
In step S101, the concrete mode of the button of definition wish simulation is for passing through HID descriptor;
According to the demand in user's request and market, can define flexibly the button of wish simulation.
Button such as definable common keyboard: as the button in major key panel, comprise letter key, punctuation mark key, enter key (Enter), Caps Lock (Cap Lock), space bar, shift key (Shift), backspace key (Backspace), operating key (Ctrl), shift key (Alt) and Tab key (Tab); As the button of keypad area; As the button in function key panel, comprise soft key (F1 ... F12), (Insert), delete key (Delete) are built in cancel key (Esc), print screen key (Print Screen), screen locking key (Sroll Lock), time-out/abort key (Pause/Break), Page Up and Page down key, first key (Home) and tail key (End), insert/rewriting.
Also can define various multimedia function buttons: as play button, add loud noise key, reduce sound key, quiet key, upper a piece of music key, next music key, dormancy key etc.
According to the demand in user's request and market, define flexibly the button of wish simulation, make method of the present invention there is good extendability.
According to the button of described wish simulation, in operating system nucleus, create dummy keyboard: the button of simulating such as the wish of definition is the button in major key panel and the button in function key panel, in operating system nucleus, creates the dummy keyboard of " button in the button in major key panel and function key panel "; Such as the button that will simulate of the definition button that is keypad area and the button in function key panel, in operating system nucleus, create the dummy keyboard of " button in the button of keypad area and function key panel ".
S102, be described dummy keyboard load driver, set up the communication interface between described dummy keyboard and client layer;
In step S102, described dummy keyboard is created in operating system nucleus, for dummy keyboard load driver is for adopting kernel-driven technology, the present invention is created in operating system kernel level by dummy keyboard, adopt kernel-driven technology, make the keystroke message of simulation be difficult for being employed software masking, make the software compatibility of method of the present invention strong.
For described dummy keyboard load driver, after driving operation to get up, carry out corresponding initialization, set up the communication interface between described dummy keyboard and client layer.
S103, at described client layer, set up the corresponding relation of user command and dummy keyboard button;
In step S103, set up the corresponding relation of user command and dummy keyboard button, shown in following form:
User command Dummy keyboard button
Letter A http://www.baidu.com
Letter b ping192.168.1.1
Letter C 1/a、2:b_3+c
The implication of this corresponding relation is: when user is during at client layer input alphabet A, " http://www.baidu.com " a string character string of dummy keyboard will be triggered, a kind of implementation is: when user presses alphabetical A key on keyboard, " http://www.baidu.com " a string character string of dummy keyboard will be triggered, the effect reaching is: user only needs a simple action----press alphabetical A key, can complete the operation of a lot of complexity----be equivalent to input character string " http://www.baidu.com ", thereby reach liberation both hands, the object of raising the efficiency, because dummy keyboard is created in operating system kernel level, adopt kernel-driven technology, make the keystroke message " http://www.baidu.com " of simulation be difficult for being shielded by other application software, make the software compatibility of method of the present invention strong, such as method of the present invention can in the situation that other the application software such as QQ, browser, CAD move.
The mode of setting up the corresponding relation of user command and dummy keyboard button can realize by the software of a client layer, and this software has the input position of " user command " and corresponding " dummy keyboard button ".
Whether S104, monitoring have user command to arrive, if had, perform step S105; Otherwise, return to this step;
In step S104, at step S103, set up after the corresponding relation of user command and dummy keyboard button, monitor and whether have user command to arrive.For example, establishing shown in step S103 after the corresponding relation in form, monitor and whether have user command to arrive, if the user command of having listened to " alphabetical A " arrives, trigger dummy keyboard button " http://www.baidu.com " corresponding to described user command " alphabetical A "; If the user command of having listened to " letter b " arrives, trigger dummy keyboard button " ping192.168.1.1 " corresponding to described user command " letter b ".
S105, according to described corresponding relation, trigger dummy keyboard button corresponding to described user command;
In step S105, when dummy keyboard monitoring has user command to arrive,, according to the corresponding relation of the user command of setting up in step S103 and dummy keyboard button, trigger dummy keyboard button corresponding to described user command, thereby reach the effect of simulating keyboard keystroke action.
Method of the present invention creates dummy keyboard in operating system nucleus, sets up the communication interface between described dummy keyboard and client layer; The present invention is created in operating system kernel level by dummy keyboard, adopts kernel-driven technology, makes the keystroke message of simulation be difficult for being employed software masking, and the software compatibility of method of the present invention is strong.
Referring to Fig. 2, a kind of device with software simulation keyboard, comprising:
Dummy keyboard creating unit 100, for defining the button of wish simulation, the button according to described wish simulation creates dummy keyboard in operating system nucleus;
The mode of the button of described definition wish simulation is for passing through HID descriptor.
Described button is button or the multimedia function button of common keyboard.
Button such as definable common keyboard: as the button in major key panel, comprise letter key, punctuation mark key, enter key (Enter), Caps Lock (Cap Lock), space bar, shift key (Shift), backspace key (Backspace), operating key (Ctrl), shift key (Alt) and Tab key (Tab); As the button of keypad area; As the button in function key panel, comprise soft key (F1 ... F12), (Insert), delete key (Delete) are built in cancel key (Esc), print screen key (Print Screen), screen locking key (Sroll Lock), time-out/abort key (Pause/Break), Page Up and Page down key, first key (Home) and tail key (End), insert/rewriting.
Also can define various multimedia function buttons: as play button, add loud noise key, reduce sound key, quiet key, upper a piece of music key, next music key, dormancy key etc.
According to the demand in user's request and market, define flexibly the button of wish simulation, make method of the present invention there is good extendability.
Communication interface is set up unit 200, is used to described dummy keyboard load driver, sets up the communication interface between described dummy keyboard and client layer;
The corresponding relation of user command and dummy keyboard button is set up unit 300, for set up the corresponding relation of user command and dummy keyboard button at described client layer;
Whether user command monitoring unit 400, have user command to arrive for monitoring, if had, according to described corresponding relation, triggers dummy keyboard button corresponding to described user command; Otherwise whether continue to monitor has user command to arrive.
Device of the present invention creates dummy keyboard in operating system nucleus, sets up the communication interface between described dummy keyboard and client layer; The present invention is created in operating system kernel level by dummy keyboard, adopts kernel-driven technology, makes the keystroke message of simulation be difficult for being employed software masking, makes the software compatibility of device of the present invention strong.
Know-why of the present invention has below been described in conjunction with specific embodiments.These are described is in order to explain principle of the present invention, and can not be interpreted as by any way limiting the scope of the invention.Explanation based on herein, those skilled in the art does not need to pay performing creative labour can associate other embodiment of the present invention, within these modes all will fall into protection scope of the present invention.

Claims (8)

1. a method for Simulation of keyboard input, is characterized in that, comprising:
The button of definition wish simulation, the button according to described wish simulation creates dummy keyboard in operating system nucleus;
For described dummy keyboard load driver, set up the communication interface between described dummy keyboard and client layer;
At described client layer, set up the corresponding relation of user command and dummy keyboard button;
Monitor and whether have user command to arrive, if had, according to described corresponding relation, trigger dummy keyboard button corresponding to described user command; Otherwise whether continue to monitor has user command to arrive.
2. the method for Simulation of keyboard input according to claim 1, is characterized in that, described button is multimedia function button.
3. the method for Simulation of keyboard input according to claim 1, is characterized in that the button that described button is common keyboard.
4. the method for Simulation of keyboard input according to claim 1, is characterized in that, the mode of the button of described definition wish simulation is for by HID descriptor definition.
5. a device for Simulation of keyboard input, is characterized in that, comprising:
Dummy keyboard creating unit, for defining the button of wish simulation, the button according to described wish simulation creates dummy keyboard in operating system nucleus;
Communication interface is set up unit, is used to described dummy keyboard load driver, sets up the communication interface between described dummy keyboard and client layer;
The corresponding relation of user command and dummy keyboard button is set up unit, for set up the corresponding relation of user command and dummy keyboard button at described client layer;
Whether user command monitoring unit, have user command to arrive for monitoring, if had, according to described corresponding relation, triggers dummy keyboard button corresponding to described user command; Otherwise whether continue to monitor has user command to arrive.
6. the device of Simulation of keyboard input according to claim 5, is characterized in that, described button is multimedia function button.
7. the device of Simulation of keyboard input according to claim 5, is characterized in that the button that described button is common keyboard.
8. the device of Simulation of keyboard input according to claim 5, is characterized in that, the mode of the button of described definition wish simulation is for by HID descriptor definition.
CN201310642546.2A 2013-12-03 2013-12-03 Method and device for simulating keyboard input Pending CN103605430A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310642546.2A CN103605430A (en) 2013-12-03 2013-12-03 Method and device for simulating keyboard input

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310642546.2A CN103605430A (en) 2013-12-03 2013-12-03 Method and device for simulating keyboard input

Publications (1)

Publication Number Publication Date
CN103605430A true CN103605430A (en) 2014-02-26

Family

ID=50123663

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310642546.2A Pending CN103605430A (en) 2013-12-03 2013-12-03 Method and device for simulating keyboard input

Country Status (1)

Country Link
CN (1) CN103605430A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630189A (en) * 2016-02-05 2016-06-01 飞天诚信科技股份有限公司 Method and apparatus for implementing inputting of analog keyboard
CN107797677A (en) * 2017-07-26 2018-03-13 上海壹账通金融科技有限公司 Login parameters input method, device, platform and readable storage medium storing program for executing
CN110308940A (en) * 2019-07-04 2019-10-08 北京计算机技术及应用研究所 A kind of method that simulating keyboard soft-off key realizes long-range soft-off
CN111190529A (en) * 2018-11-15 2020-05-22 鸿合科技股份有限公司 Keyboard input method and device and electronic equipment
CN111222128A (en) * 2019-12-31 2020-06-02 北京握奇数据股份有限公司 Method and module for safely inputting and checking USBKey PIN code
CN112684914A (en) * 2020-12-31 2021-04-20 深圳雷柏科技股份有限公司 Kernel-driven-based method for realizing keyboard and mouse function modification and related equipment
CN113672407A (en) * 2021-08-24 2021-11-19 深圳技德终端技术有限公司 Linux-compatible Android keyboard input control method and device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6460103B1 (en) * 1999-04-13 2002-10-01 Compaq Computer Corporation Method and apparatus for rapidly responding to routine software requests
CN1547690A (en) * 2001-08-29 2004-11-17 ̩ Anti keylog editor of activex base
CN1570841A (en) * 2003-04-23 2005-01-26 三星电子株式会社 3d-input device and method, soft key mapping method therefor, and virtual keyboard
CN1628282A (en) * 2002-02-07 2005-06-15 卡特纳斯有限公司 Input device, mobile telephone, and mobile information device
WO2008077628A2 (en) * 2006-12-22 2008-07-03 Virtuallogix Sa System for enabling multiple execution environments to share a device
CN102314348A (en) * 2011-09-15 2012-01-11 Tcl集团股份有限公司 Android system development framework and development device
CN102854974A (en) * 2011-06-30 2013-01-02 奇智软件(北京)有限公司 Method and system for implementation of virtual input equipment in driving layer

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6460103B1 (en) * 1999-04-13 2002-10-01 Compaq Computer Corporation Method and apparatus for rapidly responding to routine software requests
CN1547690A (en) * 2001-08-29 2004-11-17 ̩ Anti keylog editor of activex base
CN1628282A (en) * 2002-02-07 2005-06-15 卡特纳斯有限公司 Input device, mobile telephone, and mobile information device
CN1570841A (en) * 2003-04-23 2005-01-26 三星电子株式会社 3d-input device and method, soft key mapping method therefor, and virtual keyboard
WO2008077628A2 (en) * 2006-12-22 2008-07-03 Virtuallogix Sa System for enabling multiple execution environments to share a device
CN102854974A (en) * 2011-06-30 2013-01-02 奇智软件(北京)有限公司 Method and system for implementation of virtual input equipment in driving layer
CN102314348A (en) * 2011-09-15 2012-01-11 Tcl集团股份有限公司 Android system development framework and development device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
徐宁: "基于Linux内核的键盘模拟实现", 《可编程控制器与工厂自动化》 *

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630189A (en) * 2016-02-05 2016-06-01 飞天诚信科技股份有限公司 Method and apparatus for implementing inputting of analog keyboard
CN105630189B (en) * 2016-02-05 2018-04-03 飞天诚信科技股份有限公司 A kind of method and device for realizing Simulation of keyboard input
CN107797677A (en) * 2017-07-26 2018-03-13 上海壹账通金融科技有限公司 Login parameters input method, device, platform and readable storage medium storing program for executing
CN107797677B (en) * 2017-07-26 2020-12-22 深圳壹账通智能科技有限公司 Login parameter input method, device, platform and readable storage medium
CN111190529A (en) * 2018-11-15 2020-05-22 鸿合科技股份有限公司 Keyboard input method and device and electronic equipment
CN111190529B (en) * 2018-11-15 2024-04-30 鸿合科技股份有限公司 Keyboard input method and device and electronic equipment
CN110308940A (en) * 2019-07-04 2019-10-08 北京计算机技术及应用研究所 A kind of method that simulating keyboard soft-off key realizes long-range soft-off
CN110308940B (en) * 2019-07-04 2022-06-21 北京计算机技术及应用研究所 Method for realizing remote soft-off by simulating keyboard soft-off key
CN111222128A (en) * 2019-12-31 2020-06-02 北京握奇数据股份有限公司 Method and module for safely inputting and checking USBKey PIN code
CN112684914A (en) * 2020-12-31 2021-04-20 深圳雷柏科技股份有限公司 Kernel-driven-based method for realizing keyboard and mouse function modification and related equipment
CN112684914B (en) * 2020-12-31 2021-11-19 深圳雷柏科技股份有限公司 Kernel-driven-based method for realizing keyboard and mouse function modification and related equipment
CN113672407A (en) * 2021-08-24 2021-11-19 深圳技德终端技术有限公司 Linux-compatible Android keyboard input control method and device

Similar Documents

Publication Publication Date Title
CN103605430A (en) Method and device for simulating keyboard input
JP2008547096A5 (en)
CN107193743B (en) Application evaluation method and device, computer equipment and storage medium
CN105956441B (en) A kind of intelligent terminal operating method and system
JP2016525248A (en) Method and terminal for changing keys of touch keyboard
CN102999167A (en) Method for operating virtual keyboard inside mobile terminal by PC (personal computer) terminal key
JP2016531352A (en) Method, device, program and device for updating input system
CN1976373A (en) Method for controlling computer PPT program via cell phone
US10168898B2 (en) Supporting different event models using a single input source
RU2015153214A (en) TESTING INDEPENDENT PRESSES FOR MANIPULATIONS WITH A TOUCH PANEL AND ZOOMING BY DOUBLE TOUCH
US20140139437A1 (en) Speed adjustable usb keyboard
CN102929688A (en) Method for realizing simulator for simulating touch screen and simulator
CN103294223B (en) The input method of a kind of Chinese pinyin and terminal unit
MX2014008310A (en) Input pointer delay.
CN103207739B (en) The method and apparatus that a kind of intelligence cuts out input method
CN105094355A (en) Input method and related electronic device
TWI431508B (en) Method for testing keyboard
CN104331214B (en) Information processing method and electronic equipment
CN113407044B (en) Method, device, equipment and storage medium for simulating terminal handle input
CN106020520B (en) A kind of information processing method and electronic equipment
CN102193644A (en) Computer system and method for simulating input of keyboard
CN106406662A (en) Management method and system of application with function of generating replications
CN106817491A (en) The control method and device of the network connection of terminal
JP2021111336A (en) Update method of skill service, device, electronic apparatus, program, and readable storage medium
WO2016029554A1 (en) Mobile terminal control method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20140226

RJ01 Rejection of invention patent application after publication