版本比较
结束极域
正文
增加 67 行删除 14 行
12345678899101112131414 行未改动293031323233333435353636373938394140414243464445484647484911 行未改动61626364686566706768697071767273747576778278798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140## 极域版```cpp#include <windows.h>#include <string>#include <cstdlib>#include <thread>#include <chrono>
void ExecuteCommand(const std::wstring& command) { _wsystem(command.c_str());void ExecuteCommand(const std::string& command) { system(command.c_str());}
// 检查鼠标左右键是否同时按下bool AreBothMouseButtonsPressed() {14 行未改动 return (GetAsyncKeyState(vk) & 0x8000) != 0;}
int main() { std::wstring killCommand = L"taskkill /f /t /im StudentMain.exe"; std::wstring startCommand = L"start \"\" \"C:\\Program Files (x86)\\Mythware\\StudentMain.exe\""; std::string killCommand = "taskkill /f /t /im StudentMain.exe"; std::string startCommand = "start \"\" \"C:\\Program Files (x86)\\Mythware\\极域电子教室软件 v4.0 2015 豪华版\\StudentMain.exe\""; bool wasKillTriggered = true; while (true) { // 检查鼠标左右键是否同时按下(结束程序) if (AreBothMouseButtonsPressed() && !wasKillTriggered) { if (AreBothMouseButtonsPressed()) { ExecuteCommand(killCommand); wasKillTriggered = true; std::this_thread::sleep_for(std::chrono::milliseconds(500)); // 防抖 } // 检查鼠标中键是否按下(启动程序) if (IsMiddleMouseButtonPressed() && wasKillTriggered) { if (IsMiddleMouseButtonPressed()) { ExecuteCommand(startCommand); wasKillTriggered = false; std::this_thread::sleep_for(std::chrono::milliseconds(500)); // 防抖 } // 检查上下键是否同时按下(隐藏屏幕广播窗口)11 行未改动 break; } // 检查鼠标左右键是否同时按下(结束程序) if (AreBothMouseButtonsPressed() && !wasKillTriggered) { if (AreBothMouseButtonsPressed()) { ExecuteCommand(killCommand); wasKillTriggered = true; std::this_thread::sleep_for(std::chrono::milliseconds(500)); // 防抖 break; } // 短暂延迟,降低CPU使用率 std::this_thread::sleep_for(std::chrono::microseconds(1)); std::this_thread::sleep_for(std::chrono::milliseconds(1)); } } } // 短暂延迟,降低CPU使用率 std::this_thread::sleep_for(std::chrono::milliseconds(50)); std::this_thread::sleep_for(std::chrono::milliseconds(10)); } return 0;}```## QQ 版```cpp#include <windows.h>#include <string>#include <cstdlib>#include <thread>#include <chrono>
void ExecuteCommand(const std::string& command) { system(command.c_str());}
// 检查鼠标左右键是否同时按下bool AreBothMouseButtonsPressed() { // 获取鼠标状态 bool leftPressed = (GetAsyncKeyState(VK_LBUTTON) & 0x8000) != 0; bool rightPressed = (GetAsyncKeyState(VK_RBUTTON) & 0x8000) != 0; return leftPressed && rightPressed;}
// 检查键盘按键是否按下bool IsKeyPressed(int vk) { return (GetAsyncKeyState(vk) & 0x8000) != 0;}
int main() { std::string killCommand = "taskkill /f /t /im StudentMain.exe"; std::string startCommand = "start \"\" \"C:\\Program Files (x86)\\Mythware\\极域电子教室软件 v4.0 2015 豪华版\\StudentMain.exe\""; while (true) { // 检查上下键是否同时按下(隐藏 QQ 窗口) if (IsKeyPressed(VK_UP) && IsKeyPressed(VK_DOWN)) { HWND hwnd = FindWindow(NULL, "QQ"); if (hwnd) { // 切换窗口显示状态 while (1) { ShowWindow(hwnd, false); // 检查左右键是否同时按下(显示屏幕广播窗口) if (IsKeyPressed(VK_LEFT) && IsKeyPressed(VK_RIGHT)) { HWND hwnd = FindWindow(NULL, "QQ"); if (hwnd) ShowWindow(hwnd, true); break; } // 短暂延迟,降低CPU使用率 std::this_thread::sleep_for(std::chrono::milliseconds(1)); } } } // 短暂延迟,降低CPU使用率 std::this_thread::sleep_for(std::chrono::milliseconds(10)); } return 0;}```