抖动窗口
2025-06-17 18:24:06
发布于:广东
#include <windows.h>
#include <cstdlib>
#include <ctime>
const int length = 100; // 晃动强度,越大越强
int main() {
srand(time(0));
HWND hwnd = GetForegroundWindow();
RECT rect;
GetWindowRect(hwnd, &rect);
int origX = rect.left;
int origY = rect.top;
while (true) {
int x = origX + (rand() % length);
int y = origY + (rand() % length);
SetWindowPos(hwnd, NULL, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
Sleep(50);
SetWindowPos(hwnd, NULL, origX, origY, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
}
return 0;
}
这里空空如也
有帮助,赞一个