1. Roland Smith
  2. PowerBuilder
  3. Sunday, 11 October 2020 03:52 AM UTC

Is it possible to have the menu item image sourced from an exe or dll contained one or more icons?

Some features of Windows show an icon from a registry setting that has the full exe filename followed by a comma and then a number which is the icon index.

If not natively, perhaps an API function?

René Ullrich Accepted Answer Pending Moderation
  1. Wednesday, 14 October 2020 05:37 AM UTC
  2. PowerBuilder
  3. # 1

Hi Roland,

I think the Windows API for resources are what you need.

https://docs.microsoft.com/en-us/windows/win32/menurc/introduction-to-resources

Problem could be: Enum functions (to get a list of all resources) needs callback functions.

HTH,

René

 

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 13 October 2020 19:03 PM UTC
  2. PowerBuilder
  3. # 2

Hi Roland;

  Yes, that would be a "kool" IDE feature but, could allow copyright infringements as well. I am not sure how Appeon could protect themselves from that aspect.

  However, there are a plethora of free IconEdit tool that can extract any ICO from any DLL, EXE, etc.

For example:  https://www.freewarefiles.com/Icons-From-File-screenshot-20636.html

HTH

Regards ... Chris

Comment
  1. Roland Smith
  2. Wednesday, 14 October 2020 01:58 AM UTC
The use case is a window showing a list of files. Right-clicking on the file opens a menu. One of the menu items replicates the 'Open With' menu from Windows Explorer. I would like to show the icon of the exe associated with the file type.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 14 October 2020 15:41 PM UTC
Hi Roland;

Yes, you would need to use some MS-Window API's for an "on-the-fly" icon extraction. Unfortunately, something that I have never had to do. So I cannot advise you any further. Hopefully, René's URL link will help.

Regards ... Chris
  1. Helpful
  1. Roland Smith
  2. Wednesday, 14 October 2020 16:46 PM UTC
I have an example on my website that does it for treeview & listview controls. I'll have to investigate doing it for menus.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.