CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Learn How to Create Dual Mode Windows Services
  • XBox live shutting down for original XBox consoles
  • Windows 7 release candidate (RC) will soon expire
  • Facebook removes Microsoft banner ads

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > C++ and WinAPI
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    C++ and WinAPI Discuss Windows API related issues using C++ (and Visual C++). This is a non-MFC forum.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old September 13th, 2009, 11:37 PM
    Jakman4242 Jakman4242 is offline
    Junior Member
     
    Join Date: Aug 2009
    Posts: 7
    Jakman4242 is an unknown quantity at this point (<10)
    Taking .exe icons and using them in my app.

    I'm making a little program that just makes my desktop a whole lot cleaner. To do this, I'm using a listbox dialog. When you select the appropriate item in the list, it opens the program.

    I want this to be as dynamic as I possibly can have it. I'd also like it to look very stylish, and display the proper icon in relation to the given program.

    So,
    Is there any way I can get the icon data from a .exe file, and load it into my ImageList component?
    Reply With Quote
      #2    
    Old September 14th, 2009, 06:22 AM
    VictorN's Avatar
    VictorN VictorN is offline
    Elite Member
    Power Poster
     
    Join Date: Jan 2003
    Location: Wallisellen (Zürich), Switzerland
    Posts: 10,221
    VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+)
    Re: Taking .exe icons and using them in my app.

    Quote:
    Originally Posted by Jakman4242 View Post
    ...
    Is there any way I can get the icon data from a .exe file, and load it into my ImageList component?
    Have a look at ExtractIcon(Ex) API
    __________________
    Victor Nijegorodov
    Reply With Quote
      #3    
    Old September 15th, 2009, 01:27 PM
    salehhamadeh's Avatar
    salehhamadeh salehhamadeh is offline
    Member
     
    Join Date: Sep 2009
    Posts: 55
    salehhamadeh is an unknown quantity at this point (<10)
    Re: Taking .exe icons and using them in my app.

    Read this page: http://msdn.microsoft.com/en-us/libr...68(VS.85).aspx
    Reply With Quote
      #4    
    Old October 17th, 2009, 01:53 AM
    Jakman4242 Jakman4242 is offline
    Junior Member
     
    Join Date: Aug 2009
    Posts: 7
    Jakman4242 is an unknown quantity at this point (<10)
    Re: Taking .exe icons and using them in my app.

    After much work(and a huge break from the project) I finally have an HICON handle ready to use.

    After lots and lots of searching, I can't seem to find a working method to inject it into my Imagelist control.
    Help much appreciated!

    Last edited by Jakman4242; October 17th, 2009 at 02:05 AM.
    Reply With Quote
      #5    
    Old October 19th, 2009, 12:44 PM
    VictorN's Avatar
    VictorN VictorN is offline
    Elite Member
    Power Poster
     
    Join Date: Jan 2003
    Location: Wallisellen (Zürich), Switzerland
    Posts: 10,221
    VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+)
    Re: Taking .exe icons and using them in my app.

    Quote:
    Originally Posted by Jakman4242 View Post
    ... After lots and lots of searching, I can't seem to find a working method to inject it into my Imagelist control.
    And how did you try it?
    __________________
    Victor Nijegorodov
    Reply With Quote
      #6    
    Old October 22nd, 2009, 04:19 PM
    Jakman4242 Jakman4242 is offline
    Junior Member
     
    Join Date: Aug 2009
    Posts: 7
    Jakman4242 is an unknown quantity at this point (<10)
    Re: Taking .exe icons and using them in my app.

    Quote:
    Originally Posted by VictorN View Post
    And how did you try it?
    Most of it involved trying to get the HICON handle and put that into a Bitmap instance.

    The big problem in this was, whenever I tried using the function Bitmap::FromHicon() I'd get the following error, as if the function was protected?
    Code:
    HICON exticon = ExtractIcon(0, str, 0);
    Bitmap bmp;
    bmp.FromHicon(exticon);
    [error C3767: 'System::Drawing::Bitmap::Bitmap': candidate function(s) not accessible]
    Reply With Quote
      #7    
    Old October 23rd, 2009, 03:49 AM
    VictorN's Avatar
    VictorN VictorN is offline
    Elite Member
    Power Poster
     
    Join Date: Jan 2003
    Location: Wallisellen (Zürich), Switzerland
    Posts: 10,221
    VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+) VictorN has a reputation beyond repute (3000+)
    Re: Taking .exe icons and using them in my app.

    Quote:
    Originally Posted by Jakman4242 View Post
    ... The big problem in this was, whenever I tried using the function Bitmap::FromHicon() I'd get the following error, as if the function was protected?
    Code:
    HICON exticon = ExtractIcon(0, str, 0);
    Bitmap bmp;
    bmp.FromHicon(exticon);
    [error C3767: 'System::Drawing::Bitmap::Bitmap': candidate function(s) not accessible]
    You seem to better ask your question in a C++/CLI or .NET Programming forum
    __________________
    Victor Nijegorodov
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > C++ and WinAPI


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 05:54 AM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.