一般那些病毒不只是错误图标,是鼠标乱飞和错误图标结合。
#include<iostream>
#include<windows.h>
using namespace std;
int main(){
int iDesktopWidth = GetSystemMetrics(SM_CXSCREEN);
int iDesktopHeight = GetSystemMetrics(SM_CYSCREEN);
HWND hDesktop = GetDesktopWindow();
HDC hdc = GetWindowDC(hDesktop);
while(true){
int x=GetSystemMetrics(SM_CXSCREEN);
int y=GetSystemMetrics(SM_CYSCREEN);
SetCursorPos(rand()%x,rand()%y);
POINT cursor;
GetCursorPos(&cursor);
DrawIcon(hdc, cursor.x - 10, cursor.y - 10, LoadIcon(NULL, IDI_ERROR));
}
}
这段代码模拟了一种病毒行为,它获取桌面窗口的设备上下文,然后在屏幕随机位置设置鼠标位置并绘制错误图标,导致鼠标看起来乱飞且伴有错误图标显示。
56

被折叠的 条评论
为什么被折叠?



