【发布时间】:2019-10-21 15:58:08
【问题描述】:
我想通过模仿键盘将 4 位数字的所有可能组合注入到不同的程序(例如记事本)中,但我终其一生都无法弄清楚如何使用 SendInput() 函数,或者是否有更好的选择。
string code;
for (int digit1 = startThousand; digit1 < 10; digit1++){
for (int digit2 = 0; digit2 < 10; digit2++){
for (int digit3 = 0; digit3 < 10; digit3++){
for (int digit4 = 0; digit4 < 10; digit4++){
code = (std::to_string(digit1)+std::to_string(digit2)+std::to_string(digit3)+std::to_string(digit4));
//generating the 4 digit codes and outputting the final code into a single variable
cout << code << "\n";
//printing the code
SendInput(code, ???, sizeof(code))
//sending the code into a different program
}}}}
【问题讨论】:
-
你谷歌SendInput并查看Microsoft's documentation吗?您需要“一组 INPUT 结构。每个结构代表一个要插入到键盘或鼠标输入流中的事件。”你试过做一个吗?
-
我刚开始使用 C++,我不知道这意味着什么......