中级光能
出处:https://blog.csdn.net/tutu_567/article/details/119684506
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int x,n,num;
POINT point1,point2;
void copy(){
DWORD content;
char buf[10000] = {0};
HGLOBAL hGlobal;
fgets(buf, sizeof(buf), stdin);
hGlobal = GlobalAlloc(GPTR, (lstrlenA(buf) + 1));
char*pGlobal = (char*)GlobalLock(hGlobal);
lstrcpyA(pGlobal, buf);
GlobalUnlock(hGlobal);
OpenClipboard(NULL);
EmptyClipboard();
SetClipboardData(CF_TEXT, hGlobal);
CloseClipboard();
}
void test(){
SetConsoleTitle("");
cout<<"刷屏器"<<endl;
cout<<"如再使用,将重新弹窗" <<endl;
system ("color f1");
cout<<"请输入刷屏内容:";
copy();
cout<<"请输入刷屏次数:";
cin>>n;
cout<<"请输入刷屏间隔:";
cin>>num;
MessageBox(NULL,"请在点击确定后5秒内将鼠标移动至聊天输入框并保持","刷屏器",MB_OK);
ShowWindow(GetConsoleWindow(),0);
Sleep(5000);
GetCursorPos(&point1);
ShowWindow(GetConsoleWindow(),4);
ShowWindow(GetConsoleWindow(),0);
for(int i=0;i<n;i++){
GetCursorPos(&point2);
SetCursorPos(point1.x,point1.y);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
keybd_event(VK_CONTROL,0,0,0);
keybd_event('V',0,0,0);
keybd_event('V',0,KEYEVENTF_KEYUP,0);
keybd_event(VK_CONTROL,0,KEYEVENTF_KEYUP,0);
keybd_event(VK_RETURN,0,0,0);
keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0);
SetCursorPos(point2.x,point2.y);
Sleep(num);
}
cout<<endl;
}
int main()
{
test();
MessageBox(NULL,"刷屏成功!","刷屏器",MB_OK);
ShowWindow(GetConsoleWindow(),5);
cout<<"是否继续刷屏(1是 2否):";
cin>>x;
if(x==1)
{
system("exit");
system("start 新版刷屏器");
return 0;
}
}