I want to implement a program that receives a pre-set txt file or a string right away and enters the initial neutral last name one by one like a person entering it. There is no problem because there is a lot of data on the Internet until it is distinguished from the initial neutral species, but I can't think of a way to implement it as if it were directly input by humans.
The way I thought about it was to save the word "friend" in a string array like "'", "chi", and "chin", but I think it's inefficient, so I'm looking for help.
c++ c
SendInput of win32 is available in Windows.
The following code is executed, followed by a keyboard input of gotlzhem
after 5 seconds. In Korean, it corresponds to hash code
. As soon as it runs, if you run Notepad and wait, you enter hash code
(must be selected in Korean).)
I turned it around in the visual studio.
#include "stdafx.h"
#include <windows.h>
int main()
{
INPUT ip;
// 5 seconds
Sleep(5000);
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0; // hardware scan code for key
ip.ki.time = 0;
ip.ki.dwExtraInfo = 0;
ip.ki.wVk = 0x47; // virtual-key code for the "h" key
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = 0x4F; // virtual-key code for the """ key
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = 0x54; // virtual-key code for the "s" key
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = 0x4C; // virtual-key code for the """ key
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = 0x5A; // virtual-key code for the "k" key
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = 0x48; // virtual-key code for the """ key
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = 0x45; // virtual-key code for the "c" key
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
ip.ki.wVk = 0x4D; // virtual-key code for the "-" key
ip.ki.dwFlags = 0; // 0 for key press
SendInput(1, &ip, sizeof(INPUT));
// // Release the "A" key
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release
SendInput(1, &ip, sizeof(INPUT));
return 0;
}
This is what happens when you run it.
If you want another letter, please refer to here and match the code you want.
© 2024 OneMinuteCode. All rights reserved.