注册表中为什么“exeName.exe,1”可以表示应用程序的图标?

LiarMaiq 2016-06-26 10:01:34
如果不是1是其他数字又表示什么意思呢,很困惑,网上找了很久都没有找到相关的内容解释;
还有在文件指定类型文件与应用程序关联的注册表项中这些又表示什么意思,我该如何设置它们的值呢?
...全文
469 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2016-06-28
  • 打赏
  • 举报
回复
微软在注册表中规定这样书写,系统会去分析这个字符串并去加载对应的字符串和图标。常见的有:
REG_SZ(系统将直接解析路径部分)
notepad.exe,1 —— 引用图标序号1
shell32.dll,-16769 —— 引用图标ID号16769
@shell32.dll,-51334 —— 引用字符串ID号51334

REG_EXPAND_SZ(系统会先将路径部分环境变量展开)
%SystemRoot%\system32\notepad.exe,1 —— 引用图标序号1
%SystemRoot%\system32\shell32.dll,-16769 —— 引用图标ID号16769
@%SystemRoot%\system32\shell32.dll,-51334 —— 引用字符串ID号51334
paschen 2016-06-27
  • 打赏
  • 举报
回复
引用 2 楼 JI_LING 的回复:
[quote=引用 1 楼 paschen 的回复:] 使用这个exe文件里索引为1的位图作为图标 这里有说到:http://www.360doc.com/content/12/0812/19/3688062_229808059.shtml
感谢帮助,基本明白了,不过还有个问题,如何能知道一个文件里都包含那些图标以及它们的索引呢?[/quote] 参看PE文件格式解析,或者使用一些工具,如Resource Hacker
赵4老师 2016-06-27
  • 打赏
  • 举报
回复
ExtractIconEx The ExtractIconEx function creates an array of handles to large or small icons extracted from the specified executable file, dynamic-link library (DLL), or icon file. UINT ExtractIconEx( LPCTSTR lpszFile, int nIconIndex, HICON FAR *phiconLarge, HICON FAR *phiconSmall, UINT nIcons ); Parameters lpszFile Pointer to a null-terminated string specifying the name of an executable file, DLL, or icon file from which icons will be extracted. nIconIndex Specifies the zero-based index of the first icon to extract. For example, if this value is zero, the function extracts the first icon in the specified file. If this value is –1 and phIconLarge and phiconSmall are both NULL, the function returns the total number of icons in the specified file. If the file is an executable file or DLL, the return value is the number of RT_GROUP_ICON resources. If the file is an .ICO file, the return value is 1. Windows 95, Windows NT 4.0, and later: If this value is a negative number and either phIconLarge or phiconSmall is not NULL, the function begins by extracting the icon whose resource identifier is equal to the absolute value of nIconIndex. For example, use -3 to extract the icon whose resource identifier is 3. phiconLarge Pointer to an array of icon handles which receives handles to the large icons extracted from the file. If this parameter is NULL, no large icons are extracted from the file. phiconSmall Pointer to an array of icon handles which receives handles to the small icons extracted from the file. If this parameter is NULL, no small icons are extracted from the file. nIcons Specifies the number of icons to extract from the file. Return Values If the nIconIndex parameter is -1, the phiconLarge parameter is NULL, and the phiconSmall parameter is NULL, then the return value is the number of icons contained in the specified file. Otherwise, the return value is the number of icons successfully extracted from the file. Remarks You must destroy all icons extracted by ExtractIconEx by calling the DestroyIcon function. To retrieve the dimensions of the large and small icons, use theGetSystemMetrics function with the SM_CXICON, SM_CYICON, SM_CXSMICON, and SM_CYSMICON flags. Windows CE: The nIconIndex parameter must be zero or –N where N is a specified resource identifier. The nIcons parameter must be 1. QuickInfo Windows NT: Requires version 3.5 or later. Windows: Requires Windows 95 or later. Windows CE: Requires version 1.0 or later. Header: Declared in shellapi.h. Import Library: Use shell32.lib. Unicode: Implemented as Unicode and ANSI versions on Windows NT. See Also Icons Overview, Icon Functions, DestroyIcon, ExtractIcon
赵4老师 2016-06-27
  • 打赏
  • 举报
回复
引用 2 楼 JI_LING 的回复:
[quote=引用 1 楼 paschen 的回复:] 使用这个exe文件里索引为1的位图作为图标 这里有说到:http://www.360doc.com/content/12/0812/19/3688062_229808059.shtml
感谢帮助,基本明白了,不过还有个问题,如何能知道一个文件里都包含那些图标以及它们的索引呢?[/quote] 鼠标右键点任意一个快捷方式,选属性、更改图标、浏览,选你想看包含哪些图标的文件……
paschen 2016-06-26
  • 打赏
  • 举报
回复
使用这个exe文件里索引为1的位图作为图标 这里有说到:http://www.360doc.com/content/12/0812/19/3688062_229808059.shtml
LiarMaiq 2016-06-26
  • 打赏
  • 举报
回复
引用 1 楼 paschen 的回复:
使用这个exe文件里索引为1的位图作为图标 这里有说到:http://www.360doc.com/content/12/0812/19/3688062_229808059.shtml
感谢帮助,基本明白了,不过还有个问题,如何能知道一个文件里都包含那些图标以及它们的索引呢?

3,882

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧