• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

Cursor / Icon

I want to make a program with buttons display icons . Since an exercute file contains some icons/cursor in it without an separate .cur or .ico file , how can I extract those icon to make short cut or display it on my interface ?
0
ahTri
Asked:
ahTri
  • 4
  • 2
1 Solution
 
nietodCommented:
LoadIcon() and LoadCursor() are one way.  But LoadImage() might be the best.
0
 
nietodCommented:
LoadIcon() and LoadCursor() are one way.  But LoadImage() might be the best.
0
 
ahTriAuthor Commented:
I know about those function, how to LoadIcon() when u dont have the resource ID !!!! what I want to know is how to extract the icon from an existing program on the computer
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
nietodCommented:
Use LoadLibrary() and FreeLibrary() to load EXEs or DLLs you want to extract from.

Use EnumResourceNames() to enumerate each of the cursor or icon bitmaps in a module (DLL or EXE).  The use the functions I suggested above.
0
 
ahTriAuthor Commented:
I have not try yet cos I dont have the help file or manual here, does it need to load up the resource from the module every times the program exercute or just once and stay as static ?
0
 
nietodCommented:
That depends on what you need to do.  Obviously you will need the data (resource) every time you intend t use it.  So the question is how do you intend to use it?

If you plan to show the icons of all the files it finds in a directory, then each time it is run it could load all those files and extract their icons.  However, if you plan to allow users to browse icons in other files and then "use" them in your own program (even if those files are later deleted), then that sort of approach won't work.  In that case you will need to save the data (resource) in some way so your program can obtain it as needed.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now