none
C++中如何调用C:\Windows\system32\imageres.dll中的图标 RRS feed

  • 问题

  • 众所周知,C:\Windows\system32\imageres.dll是windows系统的所有图标存放的一个静态链接库:

    我想在一个pictureBox中显示其中的第一个图标,应该如何调用并显示呢?

    求大牛解决,最好附上代码和效果图。谢谢

    2013年8月18日 9:57

答案

  • Please refer:http://www.codeproject.com/Articles/9303/Get-icons-from-Exe-or-DLL-the-PE-way

    Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.

    2013年8月20日 1:02
    版主
  • 你好,

    以上链接中的内容是关于如何使用ExtractIcon函数和  ExtractIconEx函数从.dll 和.exe 文件获取图标。

    ExtractIcon函数从特定的可执行文件、动态连接库或者图像文件获取图标的句柄,其语法如下:

    HICON ExtractIcon(
      _Reserved_  HINSTANCE hInst,
      _In_        LPCTSTR lpszExeFileName,
      UINT nIconIndex
    );
     

    ExtractIconEx函数为获取的图标句柄创建一个句柄数组,其语法如下:

    UINT ExtractIconEx(
      _In_   LPCTSTR lpszFile,
      _In_   int nIconIndex,
      _Out_  HICON *phiconLarge,
      _Out_  HICON *phiconSmall,
      UINT nIcons
    );

    一种快捷访问便是在Visual Studio中单击“文件”,“打开文件”,输入文件路径,便可看到下图所示:

    选中“100”就看到“运行”的图标:

    如果有需要,请参看下面的链接提供的其他方法:

    Extract icons from EXE or DLL files 

    Extracting Icons from EXE/DLL and Icon Manipulation

    感谢你的支持。


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    2013年8月22日 12:41
    版主

全部回复

  • SHDefExtractIcon()

    Provides a default handler to extract an icon from a file.

    Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.

    2013年8月19日 1:41
    版主
  • 看不懂什么意思,能说详细点吗
    2013年8月19日 12:37
  • Please refer:http://www.codeproject.com/Articles/9303/Get-icons-from-Exe-or-DLL-the-PE-way

    Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.

    2013年8月20日 1:02
    版主
  • 看不懂那个讲解。其实我就是想读取一个.dll文件中的资源文件(.png格式的图片),望大牛能告诉一个简单点的方法
    2013年8月20日 12:39
  • 你好,

    以上链接中的内容是关于如何使用ExtractIcon函数和  ExtractIconEx函数从.dll 和.exe 文件获取图标。

    ExtractIcon函数从特定的可执行文件、动态连接库或者图像文件获取图标的句柄,其语法如下:

    HICON ExtractIcon(
      _Reserved_  HINSTANCE hInst,
      _In_        LPCTSTR lpszExeFileName,
      UINT nIconIndex
    );
     

    ExtractIconEx函数为获取的图标句柄创建一个句柄数组,其语法如下:

    UINT ExtractIconEx(
      _In_   LPCTSTR lpszFile,
      _In_   int nIconIndex,
      _Out_  HICON *phiconLarge,
      _Out_  HICON *phiconSmall,
      UINT nIcons
    );

    一种快捷访问便是在Visual Studio中单击“文件”,“打开文件”,输入文件路径,便可看到下图所示:

    选中“100”就看到“运行”的图标:

    如果有需要,请参看下面的链接提供的其他方法:

    Extract icons from EXE or DLL files 

    Extracting Icons from EXE/DLL and Icon Manipulation

    感谢你的支持。


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    2013年8月22日 12:41
    版主
  • 你好,

    以上链接中的内容是关于如何使用ExtractIcon函数和  ExtractIconEx函数从.dll 和.exe 文件获取图标。

    ExtractIcon函数从特定的可执行文件、动态连接库或者图像文件获取图标的句柄,其语法如下:

    HICON ExtractIcon(
      _Reserved_  HINSTANCE hInst,
      _In_        LPCTSTR lpszExeFileName,
      UINT nIconIndex
    );
     

    ExtractIconEx函数为获取的图标句柄创建一个句柄数组,其语法如下:

    UINT ExtractIconEx(
      _In_   LPCTSTR lpszFile,
      _In_   int nIconIndex,
      _Out_  HICON *phiconLarge,
      _Out_  HICON *phiconSmall,
      UINT nIcons
    );

    你能使用这种方法帮我将运行按钮提取出来并显示在一个picTureBox中吗?最好附上代码。你提供的网址中的内容太难了,看不懂


    2013年8月30日 3:21
  • 你好,

    请尝试使用LoadLibrary()加载shell32.dll,然后用LoadIcon()获取ICON句柄,接下来使用Icon::FromHandle(), ImageList::Images::Add() 将icon添加到图像列表,最后使用DestroyIcon() 进行清除。

    请参看下面链接中的代码样例:

    Icon::FromHandle Method

    论坛是交流社区,大家在这里一般讨论解决问题的方案,具体代码请自己调试分析。

    感谢你的支持。


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2013年8月30日 6:01
    版主