Need help on checkbox issue.

Pages: 12
To send keyboard input you can use the SendInput() function.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.85).aspx
1
2
    INPUT       Input = {0};
    SendInput(1, &Input, sizeof(Input));


how should i declare the Z key i want to input to?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
INPUT Z_KEY;
			
			


if (checked)
			{ 
				SetTimer(hwnd, IDT_TIMER1, 30000, NULL);
                                                                Z_KEY.ki.wVk = 0x5A;
                                                                Z_KEY.type = INPUT_KEYBOARD;
			                SendInput(1, Z_KEY, sizeof(INPUT));
			}
            else
			{
				KillTimer(hwnd, IDT_TIMER1);
                                                                Z_KEY.ki.dwFlags = KEYEVENTF_KEYUP;
                                                                SendInput(1, Z_KEY, sizeof(INPUT));
			}


like this?
I guess. I have never used SendInput(). Try it out and see what happens.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
if (checked)
			{ 
				SetTimer(hwnd, IDT_TIMER1, 30000, NULL);
				INPUT Z_KEY[1];
				Z_KEY[1].ki.wVk = 0x5A;
                Z_KEY[1].type = INPUT_KEYBOARD;
			    SendInput(1, Z_KEY, sizeof(INPUT));
			    
			}
            else
			{
				KillTimer(hwnd, IDT_TIMER1);
				INPUT Z_KEY[1];
				Z_KEY[0].ki.dwFlags = KEYEVENTF_KEYUP;
				SendInput(1, Z_KEY, sizeof(INPUT));
			}


i will try it out later. will let u know asap. thanks jose.
haha. it cannot be work.
instead of using sendinput, why dont use wm_keydown?
Topic archived. No new replies allowed.
Pages: 12