keyboard stimulation.

Posts 1–2 of 2 · Page 1 of 1
keyboard stimulation.
Hello, i use this function to stimulate keyboard to type sentences.
Code:
void Sendtext(char* strn)
{
	for(int i=0; i < strlen(strn); i++)
	{
		INPUT Input;
		ZeroMemory(&Input, sizeof(Input));
		Input.type = INPUT_KEYBOARD;
		Input.ki.dwFlags = KEYEVENTF_EXTENDEDKEY;
		Input.ki.wVk = (UCHAR)VkKeyScan(strn[i]);
		SendInput(1, &Input, sizeof(INPUT));
	}
    return;
}
it works but it has a problem which is that it cant type a letter two times. for example Sendtext("dazzle battle"); sends "dazle batle"
Sounds like your only sending KEY_DOWN and never releasing the key with KEY_UP?

Code:
 Input.ki.wvK = 'A';

Input.ki.dwFlags = KEYEVENTF_EXTENDEDKEY;

SendInput(true, &Input, sizeof(Input));

Input.ki.dwFlags = KEYEVENTF_KEYUP;

SendInput(true, &Input, sizeof(Input));
maybe something like that?
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us