当前位置:   article > 正文

最新破解头歌复制(读取剪切板模拟键盘输入)_头歌怎么复制粘贴

头歌怎么复制粘贴

打包好的exe

#include <Windows.h>
#include <iostream>
#include <string>
#include <chrono>
#include <thread>
#include <iomanip>
#include<vector>

void SimulateTyping(const std::wstring& text) {
    INPUT input;
    input.type = INPUT_KEYBOARD;
    input.ki.time = 0;
    input.ki.dwExtraInfo = 0;

    for (wchar_t ch : text) {
        if (ch == L'\n') {
            // 模拟按下 Shift 键
            input.ki.wVk = VK_SHIFT;
            input.ki.wScan = 0;
            input.ki.dwFlags = 0;
            SendInput(1, &input, sizeof(INPUT));

            // 模拟按下 Enter 键
            input.ki.wVk = VK_RETURN;
            input.ki.wScan = 0;
            input.ki.dwFlags = 0;
            SendInput(1, &input, sizeof(INPUT));

            // 松开 Shift 键和 Enter 键
            input.ki.wVk = VK_RETURN;
            input.ki.wScan = 0;
            input.ki.dwFlags = KEYEVENTF_KEYUP;
            SendInput(1, &input, sizeof(INPUT));

            input.ki.wVk = VK_SHIFT;
            input.ki.wScan = 0;
            input.ki.dwFlags = KEYEVENTF_KEYUP;
            SendInput(1, &input, sizeof(INPUT));
        }
        else {
            // 模拟普通字符的输入
            input.ki.wVk = 0;
            input.ki.wScan = ch;
            input.ki.dwFlags = KEYEVENTF_UNICODE;
            SendInput(1, &input, sizeof(INPUT));
            input.ki.dwFlags = KEYEVENTF_KEYUP | KEYEVENTF_UNICODE;
            SendInput(1, &input, sizeof(INPUT));
        }

        std::this_thread::sleep_for(std::chrono::milliseconds(10));
    }
}

int main() {
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole, FOREGROUND_GREEN);

    // 重置为默认颜色
    SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
    std::vector<std::string> lines = {
        "使用帮助:这个程序能够帮助你将剪切板内容模拟为键盘输出。",
        "教程:复制好答案后运行程序再点击编译器窗口即可"
    };
    int maxWidth = 0;
    for (const std::string& line : lines) {
        if (line.length() > maxWidth) {
            maxWidth = line.length();
        }
    }

    std::cout << "**********************************" << std::endl;
    for (const std::string& line : lines) {
        int padding = maxWidth - line.length();
        std::string formattedLine = "* " + line + std::string(padding, ' ') + " *";
        std::cout << formattedLine << std::endl;
    }
    std::cout << "**********************************" << std::endl;
    std::this_thread::sleep_for(std::chrono::seconds(5));

   if (!OpenClipboard(nullptr)) {
        std::cerr << "无法打开剪切板" << std::endl;
        return 1;
    }

    HANDLE hData = GetClipboardData(CF_UNICODETEXT);
    if (hData == nullptr) {
        std::cerr << "无法获取剪切板数据" << std::endl;
        CloseClipboard();
        return 1;
    }

    wchar_t* clipboardText = static_cast<wchar_t*>(GlobalLock(hData));
    if (clipboardText == nullptr) {
        std::cerr << "无法锁定剪切板数据" << std::endl;
        CloseClipboard();
        return 1;
    }

    CloseClipboard();

    // 模拟键盘输出
    SimulateTyping(clipboardText);

    GlobalUnlock(hData);

    return 0;
}
  • 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
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Li_阴宅/article/detail/817876
推荐阅读
相关标签
  

闽ICP备14008679号