C++之屏幕翻转(类似于病毒,一旦启动无法关闭,只能重启,但是如果开机自启....Emmmm)
2019-05-12
嗯,简单的来说就是电脑的屏幕会不断的闪,然而最重要的是,闪的过程中什么也做不了,这......
#include <windows.h> #define NUM 32767 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); void name () { static int iKeep[NUM][4]; HDC hdcScr, hdcMem; int cx, cy; HBITMAP hBitmap; HWND hwnd; int i, j, x1, y1, x2, y2; if (LockWindowUpdate(hwnd = GetDesktopWindow())) { hdcScr = GetDCEx(hwnd, NULL, DCX_CACHE | DCX_LOCKWINDOWUPDATE); hdcMem = CreateCompatibleDC(hdcScr); cx = GetSystemMetrics(SM_CXSCREEN) / 10; cy = GetSystemMetrics(SM_CYSCREEN) / 10; hBitmap = CreateCompatibleBitmap(hdcScr, cx, cy); SelectObject(hdcMem, hBitmap); srand((int)GetCurrentTime()); for (i = 0; i < 2; i++) for (j = 0; j < NUM; j++) { LockWindowUpdate(hwnd = GetDesktopWindow()); if (i == 0) { iKeep[j][0] = x1 = cx * (rand() % 10); iKeep[j][1] = y1 = cy * (rand() % 10); iKeep[j][2] = x2 = cx * (rand() % 10); iKeep[j][3] = y2 = cy * (rand() % 10); } else { x1 = iKeep[NUM - 1 - j][0]; y1 = iKeep[NUM - 1 - j][1]; x2 = iKeep[NUM - 1 - j][2]; y2 = iKeep[NUM - 1 - j][3]; } BitBlt(hdcMem, 0, 0, cx, cy, hdcScr, x1, y1, SRCCOPY); BitBlt(hdcScr, x1, y1, cx, cy, hdcScr, x2, y2, SRCCOPY); BitBlt(hdcScr, x2, y2, cx, cy, hdcMem, 0, 0, SRCCOPY); } DeleteDC(hdcMem); ReleaseDC(hwnd, hdcScr); DeleteObject(hBitmap); } } #pragma comment( linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"" ) // 这就是最重要的一个隐藏程序的代码 int main() { name(); return 0; }
因为,闪的过程什么都做不了,没有办法截图啊,我的哥,所以就这样吧
借鉴自:https://blog.csdn.net/qq78442761/article/details/69756713
发表评论: