button print string?

so i just learn new thing on youtube that if i press button once it can print 3 char. so i was thinking can i print a string text if i press button once? the VkKeyscanA only accept char so idk what to use

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <windows.h>

using namespace std;
int main()
{
    while(true) {
        Sleep(50);
        if (GetAsyncKeyState(VK_UP)) {
            return 0;
        }
        if (GetAsyncKeyState(VK_RIGHT)) {
            INPUT iNput = {0};
            INPUT tes = {0};
            iNput.type = INPUT_KEYBOARD;
            tes.type = INPUT_KEYBOARD;
            iNput.ki.wVk= VkKeyScanA('K');
            tes.ki.wVk= VkKeyScanA(VK_RETURN);
            SendInput(1,&iNput, sizeof(iNput));
            SendInput(1,&tes, sizeof(tes));
            ZeroMemory(&iNput, sizeof(iNput));
            ZeroMemory(&tes, sizeof(tes));
            iNput.ki.dwFlags= KEYEVENTF_KEYUP;
            SendInput(1,&iNput, sizeof(iNput)); 
            SendInput(1,&tes, sizeof(tes));
        }
    }
}
So what is this button? It looks like you mean key (as in keyboard)?

What does "print a string" exactly mean?

it can print 3 char
What is 'it'? '3 char' seems to be already a string?

the VkKeyscanA only accept char so idk what to use
With SendInput(...) you send one character after another. It impersonates the [key] input of the user.
Topic archived. No new replies allowed.