c# - keyboard event works only once -


I am trying to create simple key remarks - when a keyboard key is pressed, another different key generated by the code Press Here is my code: [DllImport ("user32.dll")] Static Exsternity UIT Keybaid_Avent (Byte BVK, Byte BSN, Int Davefags, Int dwExtraInfo); Public static zero keydown (system.windo.formkeys key) {key_events (byte key), 0, 0, 0); } Public static zero key (System.Windows.Forms.Keys key) {keybd_event (byte) key, 0, 0x7F, 0); } Secure Override Zero WndProc (Riff Message Me) {if (m.msg == 0x0312) {int id = m.WParam.ToInt32 (); ... if (id == 2) {keydown (key return); KeyUp (Keys.Return); } ...} base.WandProc (ref m); }

The problem is, when I press ED2 on the current hotkey, this press returns code works hardly once every 30 seconds. What's wrong with this keybd_evend winapi function? Did I use it wrong? There is nothing wrong in wndProc in other things (iid), only problems with keybud event. Pubal was the wrong functions KeyUp and KeyDown are the right functions:

[DllImport ("user32.dll")] static extern uint keybd_event (byte bvk, byte bScan, int dwFlags, int dwExtraInfo); Public static zero keydown (System.Windows.Forms.Keys key) {keybd_event (byte) key, 0x45, 0x0001 | 0, 0); } Public static zero key (System.Windows.Forms.Keys key) {keybd_event (byte) key, 0x45, 0x0001 | 0x0002, 0); }

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -