Simulated operation (keyboard and mouse) 2

Source: Internet
Author: User

Keyboard key location Daquan:

System. Windows. Forms. sendkeys

Key code
Backspace {backspace}, {BS}, or {bksp}
Break {break}
Caps Lock {capslock}
Del or delete {Delete} or {del}
Down Arrow (down arrow) {down}
End {end}
Enter {enter} Or ~
ESC {ESC}
Help {help}
Home {home}
INS, insert {insert}, or {ins}
Left arrow (left arrow) {left}
Num Lock {numlock}
Page down {pgdn}
Page up {pgup}
Print Screen {prtsc} (reserved for future use)
Right arrow (right arrow) {right}
Scroll lock {scrolllock}
Tab {tab}
Up Arrow (up arrow) {up}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {f13}
F14 {F14}
F15 {F15}
F16 {F16}
Numeric keypad plus sign {Add}
Keyboard minus {subtract}
Numeric keypad multiplication number {multiply}
Keypad division {divide}

To specify keys that can be used with any combination of shift, Ctrl, and ALT keys, add one or more codes before these key codes:

Key code
Shift + (shift = "+ ")
CTRL ^ (CTRL = "^") if you enter
Alt %

 

When using these keys, you still need sendkeys. sendwait ("operator ");

In this case, if you want to move a form other than a program, you also need to add a Windows API

// The hwnd to move the form is the handle value of the window, X, Y coordinate, nwidth, and nheight window size.

[Dllimport ("user32.dll", entrypoint = "movewindow")]
Public static extern int movewindow (INT hwnd, int X, int y, int nwidth, int nheight, int brepaint );

// Obtain the handle

[Dllimport ("user32.dll")]
Public static extern intptr findwindow (string lpclassname, string lpwindowname );

// Obtain the handle

Intptr hwnd = findwindow (null, "Name of the window to be called ");

// Move the form

Movewindow (hwnd. toint32 (), 0, 0,650,500, 0 );

 

Simulated operation (keyboard and mouse) 2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.