.net - C# detecting key event in all windows -


Hey, I have a problem with key event handler This is the source:

  system use; Using System.Collections.Generic; Using System.ComponentModel; Using System.Data; Using System.Drawing; Using System.Linq; Using System.Text; Using System.Windows.Forms; Using System.Diagnostics; Using System.Threading; Namespace WindowsFormsApplication3 {Public Partial Category Form 1: Form {Public Form 1 () {InitializeComponent (); } [System.Runtime.InteropServices.DllImport ("user32.dll")] Public static extern zero mouse_events (int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo); Public const int MOUSEEVENTF_LEFTDOWN = 0x02; Public const int MOUSEEVENTF_LEFTUP = 0x04; Public const int MOUSEEVENTF_RIGHTDOWN = 0x08; Public const int MOUSEEVENTF_RIGHTUP = 0x10; Public Zero Form 1_KOXIDE (Object Sender, KAntAgurge E) {if (e.KeyCode == Keys.F2) {Draw Square (); }} Public Zero DrawSquare () {int line = Convert.ToInt16 (textbox1.Text); Int Time = Convert. ToInt16 (textbox2.Text); Int x = MousePosition.X; Int y = MousePosition.Y; Cursor Structure = new point (x - line / 2, y - line / 2); Mouse_Auvent (MUAEAINTNTLFDDown, X, Y, 0, 0); Thread.Sleep (time); Cursor Structure = new point (x - line / 2, y + line / 2); Thread.Sleep (time); Cursor Structure = new point (x - line / 2, y + line / 2); Thread.Sleep (time); Cursor Structure = new point (x + line / 2, y - line / 2); Thread.Sleep (time); Cursor Structure = new point (x - line / 2, y - line / 2); Mouse_Avent (MOUEEEENFLLUPUP, X, Y, 0, 0); Thread.Sleep (time); Cursor Position = new point (x, y); }}}   

Now when I press F2 in the form, it only pulls squares, but I have to work on all these windows. What more do I want? (It has a little auto drawer for the right size)

If you want to handle only a few key combinations Yes, you can use it. If you want to explore all the various major events, go together.

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -