[疑难] 请教怎么为可执行程序加上图标?

jinheking 2007-04-23
包括console的和Windows的执行程序怎么添加图标?
oldrev 2007-04-23
用资源啊
shawind 2007-04-23
另外,用reshacker,restorator...这类资源编辑工具也可以为exe加上图标。
jinheking 2007-04-24
一位高人给了我下面的答案:

我搜索了一下rcc.exe是qt里面的一个可执行程序。我下载了
但是运行居然不正确

谁能给我个解释?

== Quote from jinheking (caoqi@bgi.net.cn)'s article
>  Hi all,
> Is there anybody who knows how to load an Icon in the Windows Console
> applications.
> I work with the dmd, and it concerns 32 bit Windows Console
> applications.

Do you want to have a custom icon to show up with the executable in Windows Explorer?

I'm not sure what you want to do, but you might need to use a resource script and
resource compiler:

rcc resource.rc -v -32
dmd pgm.d resource.res


Below is a sample resource script (resource.rc) and the C header file that it
depends upon.

I hope this might help.

jcc7


=== resource.rc ===

#include "resource.h"

1000 ICON MOVEABLE PURE LOADONCALL DISCARDABLE pgmIcon
1 VERSIONINFO
FILEVERSION    pgmMajVer, pgmMinVer, pgmBuild, 0
PRODUCTVERSION pgmMajVer, pgmMajVer, pgmBuild, 0
FILEOS 0x4
FILETYPE 0x1
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
        VALUE "LegalCopyright", pgmCopyright
        VALUE "FileDescription",  pgmFileDescription
VALUE "Author", "J C Calvarese"
VALUE "CompanyName", pgmCompanyName
VALUE "ProductName", pgmTitle
VALUE "FileVersion", pgmVersion
VALUE "ProductVersion", pgmVersion
VALUE "InternalName", pgmInternalName
VALUE "OriginalFilename", pgmOriginalFilename
END
END

BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409,  0x04B0 //0x0409 0x04B0
END
END


=== resource.h ===

#define pgmTitle            "pgm"
#define pgmInternalName     "pgm"
#define pgmOriginalFilename "pgm.exe"

#define pgmFileDescription  "Does Something"

#define pgmVersion "0.0.1"
#define pgmMajVer  0
#define pgmMinVer  0
#define pgmBuild   1

#define pgmCopyright "(c) 2002 Some One"
#define pgmCompanyName "My Software Company"

#define pgmIcon "pgm.ico"

#define ID_ICON 1000

ideage 2007-04-24
使用资源。参考dfl的例子。

http://wiki.dprogramming.com/Dfl/FormIconExample
Global site tag (gtag.js) - Google Analytics