Subversion Repositories group.electronics

Rev

Rev 176 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 176 Rev 177
Line 15... Line 15...
15
            this.key = key;
15
            this.key = key;
16
            this.control = control;
16
            this.control = control;
17
        }
17
        }
18
 
18
 
19
        public void Send() {
19
        public void Send() {
20
            if (control) {
20
            if (this.control) {
21
                this.inputs = new INPUT[2];
21
                this.inputs = new INPUT[2];
22
                inputs[0].type = INPUT_KEYBOARD;
22
                inputs[0].type = INPUT_KEYBOARD;
23
                inputs[0].InputUnion.ki.time = 0;
23
                inputs[0].InputUnion.ki.time = 0;
24
                inputs[0].InputUnion.ki.wVK = 0;
24
                inputs[0].InputUnion.ki.wVK = 0;
25
                inputs[0].InputUnion.ki.dwFlags = KEYEVENTF_SCANCODE;
25
                inputs[0].InputUnion.ki.dwFlags = KEYEVENTF_SCANCODE;
Line 33... Line 33...
33
                inputs[1].InputUnion.ki.wScan = (ushort)MapVirtualKey((uint)key, 0);
33
                inputs[1].InputUnion.ki.wScan = (ushort)MapVirtualKey((uint)key, 0);
34
                inputs[1].InputUnion.ki.dwExtraInfo = GetMessageExtraInfo();
34
                inputs[1].InputUnion.ki.dwExtraInfo = GetMessageExtraInfo();
35
 
35
 
36
            } else {
36
            } else {
37
                this.inputs = new INPUT[1];
37
                this.inputs = new INPUT[1];
38
                inputs[1].type = INPUT_KEYBOARD;
38
                inputs[0].type = INPUT_KEYBOARD;
39
                inputs[1].InputUnion.ki.time = 0;
39
                inputs[0].InputUnion.ki.time = 0;
40
                inputs[1].InputUnion.ki.wVK = 0;
40
                inputs[0].InputUnion.ki.wVK = 0;
41
                inputs[1].InputUnion.ki.dwFlags = KEYEVENTF_SCANCODE;
41
                inputs[0].InputUnion.ki.dwFlags = KEYEVENTF_SCANCODE;
42
                inputs[1].InputUnion.ki.wScan = (ushort)MapVirtualKey((uint)key, 0);
42
                inputs[0].InputUnion.ki.wScan = (ushort)MapVirtualKey((uint)key, 0);
43
                inputs[1].InputUnion.ki.dwExtraInfo = GetMessageExtraInfo();
43
                inputs[0].InputUnion.ki.dwExtraInfo = GetMessageExtraInfo();
44
            }
44
            }
45
 
45
 
46
 
46
 
47
            SendInput((uint)inputs.Count(), inputs, Marshal.SizeOf(typeof(INPUT)));
47
            SendInput((uint)inputs.Count(), inputs, Marshal.SizeOf(typeof(INPUT)));
48
            System.Threading.Thread.Sleep(5);
48
            System.Threading.Thread.Sleep(5);