C# 使用 Reshacker 更改可执行文件的图标

发布于 2024-11-05 20:11:55 字数 534 浏览 0 评论 0原文

这里有多个线程询问如何更改图标 - 几乎所有线程都说使用命令行工具,例如 ResHacker - 但没有一个线程(我见过)解释如何执行此操作。我阅读了 ResHacker 的帮助文件,发现一些文本解释了如何更改 win32 可执行文件的图标。

我尝试了下面的代码,它给了我以下错误: 代码:

p.StartInfo.Arguments = "-addoverwrite " + txtProtect.Text + "," + txtProtect.Text + "," + sICOpath + "," + "ICONGROUP" + ", MAINICON, 0";

错误:

“C:\Users\Evan\Desktop\ResHacker.exe”-addoverwrite C:\Users\Evan\Desktop\output.exe,C:\Users\FARINA_EVAN\Desktop\output.exe,C:\Users\Evan \Desktop\ExeWithIcon.exe,ICONGROUP, MAINICON, 0

错误:资源类型无效。

There are MULTIPLE threads here asking how to change an icon - and nearly all of them say to use a command line tool such as ResHacker - but none of them (that I have seen) explain how to do so. I read into ResHacker's help file, and I found some text which explained how to go about changing the icon of a win32 executable file.

I tried the below code, and it gave me the following error:
Code:

p.StartInfo.Arguments = "-addoverwrite " + txtProtect.Text + "," + txtProtect.Text + "," + sICOpath + "," + "ICONGROUP" + ", MAINICON, 0";

Error:

"C:\Users\Evan\Desktop\ResHacker.exe" -addoverwrite C:\Users\Evan\Desktop\output.exe,C:\Users\FARINA_EVAN\Desktop\output.exe,C:\Users\Evan\Desktop\ExeWithIcon.exe,ICONGROUP, MAINICON, 0

Error: Invalid resource type.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

勿忘心安 2024-11-12 20:11:55

我意识到这有点……旧了,但这不起作用的原因是因为您试图从 .exe 中获取图标,而该图标不适用于 ResHacker 的命令行。

我唯一能想到的就是从 .exe 中提取图标并将其另存为 .ico。

然后你就可以进行“推”了。

I realize that this is a bit... Old, but the reason this won't work is because you're trying to get the icon FROM a .exe, which doesn't work with the command line of ResHacker.

The only thing I can think of is to Extract the icon from the .exe and save it as a .ico.

Then you can do the "push."

失眠症患者 2024-11-12 20:11:55

除了像您尝试那样通过 C# 操作命令行之外,我无法找到有关如何以编程方式运行 ResHacker 的任何内容。但是,为了解决您问题的根源,我在这里为您找到了一个不需要 ResHacker 的可能解决方案。相反,它允许您通过代码(C# 和 VB.NET)修改图标。这是链接:

http://www.hackforums.net/ archive/index.php/thread-422072-1.html

I wasn't able to find anything on how to programmatically run ResHacker except through manipulating the command line through C# like you are attempting to do. However, to speak to the root of your question, I found a possible solution for you here that does not require ResHacker. Instead, it allows you to modify the icon through code (C# and VB.NET). Here is the link:

http://www.hackforums.net/archive/index.php/thread-422072-1.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文