1 Star 0 Fork 8

风继续吹 / FUDPackage

forked from 老爷爷 / FUDPackage 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
新建文本文档.txt 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
killvxk 提交于 2017-02-04 13:55 . ok GOOGOO
#include "stdafx.h"
#include <Windows.h>
BOOL CALLBACK EnumResIconProc(
__in HMODULE hModule,
__in LPCTSTR lpszType,
__in LPTSTR lpszName,//automatic
__in LONG_PTR lParam //virus file
)
{
HRSRC hRsrc = FindResource(hModule,lpszName,RT_ICON);
HGLOBAL hGlobal = LoadResource(hModule,hRsrc);
LPVOID lpData = LockResource(hGlobal );
DWORD cbData = SizeofResource(hModule,hRsrc);
if (lpData == NULL)
{
throw("Could not lock Icon.");
}
//if (lpszType == 3)
//{
HANDLE handle = BeginUpdateResource((LPCWSTR)lParam,0);
if (handle == NULL)
{
throw("Could not BeginUpdateResource");
}
BOOL flag = UpdateResource(handle,lpszType,lpszName,MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),lpData,cbData);
if (flag == NULL) throw("Could not UpdateResource");
if (!EndUpdateResource(handle,0)) throw("Could not UpdateResource");
//}
return 0;
}
void ChangeIcon(wchar_t * strSourcePath,wchar_t * strDesPath)
{
HMODULE handle = LoadLibrary(strSourcePath);
EnumResourceNames(handle, RT_ICON, (ENUMRESNAMEPROC)EnumResIconProc, (LONG_PTR)strDesPath);
FreeLibrary(handle);
}
int _tmain(int argc, _TCHAR* argv[])
{
wchar_t strSourcePath[MAX_PATH];
wchar_t strDesPath[MAX_PATH];
GetCurrentDirectory(MAX_PATH,strSourcePath);
GetCurrentDirectory(MAX_PATH,strDesPath);
wcscat(strSourcePath,TEXT("\\2.exe"));//2->1 icon ????
wcscat(strDesPath,TEXT("\\1.exe"));
ChangeIcon(strSourcePath,strDesPath);
return 0;
}
1
https://gitee.com/fengjixuchui123456/FUDPackage.git
git@gitee.com:fengjixuchui123456/FUDPackage.git
fengjixuchui123456
FUDPackage
FUDPackage
master

搜索帮助