Results 1 to 19 of 19

Thread: icon question

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    icon question

    I am getting ready to release a .NET 2003 application, and this application has a file type associated with it.

    During the installation I register the extension to be associated with my application, and everything is working fine.

    My question has to do with the icons. I want a specific icon for the exe, and also a specific icon for the files associated with my app.

    I want to have both icons in the exe file.

    I guess my question would be, how do i embed 2 different icons into an exe, so that if you selected that exe as an icon source, windows would see the different icons in it (as seperate icons)

    I know I can embed them as a resource, but windows only sees the main icon.

    To give you an example, of what I am trying to do, winamp, the mp3 player program, has several icons in its exe (see picture)

    (the visual studio IDE exe - devenv.exe - also has more than 1 icon in it)
    Attached Images Attached Images  

  2. #2
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Question Re: icon question

    Damn good question. I'm stumped.

    Like yourself, i always assumed i could embed the images, and they'd be there to pick from. But i have tested this, and you're correct. it doesn't work like that.

    I'm interested in knowing how to sove this as well.
    ~Peter


  3. #3

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: icon question

    I have done a little searching.. and it would appear you would have to include a win32 resource file in the exe... which is different than adding a managed .net resource file. I haven't finished investigating this, but it may require you use the assembly linker utility, or some other method that is outside the simple "build" from within the VS IDE

    I am not sure exactly how to do it, and for the initial release, I am just going to include the second icon as a stand alone icon, and set the associations in the installer...

    If I can find a solution to get both icons in the exe and visible to windows, I will implement that later on

  4. #4
    "The" RedHeadedLefty
    Join Date
    Aug 2005
    Location
    College Station, TX Preferred Nickname: Gig Current Mood: Just Peachy Turnons: String Manipulation
    Posts
    4,495

    Re: icon question

    There is a way to do it after you build your program in the IDE (at least in 2003 there was, havent tried it in 2005), however this method has to be done each time you want to release it, since after each build the info is overwritten...

    From This Thread: http://www.vbforums.com/showthread.php?t=378615
    Quote Originally Posted by gigemboy
    After it is built, open up the executable in Visual Studio (File > Open File). You get a tree with "Icon" and "version" as nodes. Right click the Icon Node, and choose "Insert Icon". It then brings you to an icon designer where you can create a new icon. I created a couple, then saved it, and was able to browse to the exe and have the new icons show up as well in the list when trying to change the icon in windows.

    However, the catch to this is when the exectuable is rebuilt, this process has to be repeated, as the information is cleared out because of the new EXE overwrite...

  5. #5

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: icon question

    I wonder if this can be done using a script and one of the command line utilities with Visual Studio... I will have to look into it.

    I don't know if it would be practicle or not to do it everytime manually

  6. #6
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Unhappy Re: icon question

    Nice to know there is a way to do this, but having to re-add it each time is a huge pain.
    ~Peter


  7. #7
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Re: icon question

    Quote Originally Posted by kleinma View Post
    I am getting ready to release a .NET 2003 application, and this application has a file type associated with it.

    During the installation I register the extension to be associated with my application, and everything is working fine.

    My question has to do with the icons. I want a specific icon for the exe, and also a specific icon for the files associated with my app.

    I want to have both icons in the exe file.

    I guess my question would be, how do i embed 2 different icons into an exe, so that if you selected that exe as an icon source, windows would see the different icons in it (as seperate icons)


    I know I can embed them as a resource, but windows only sees the main icon.


    To give you an example, of what I am trying to do, winamp, the mp3 player program, has several icons in its exe (see picture)

    (the visual studio IDE exe - devenv.exe - also has more than 1 icon in it)
    Hi All,

    This is *exactly* my problem:
    2 years past and Visual Studio still cannot do what we want:

    I know I can embed them as a resource, but windows only sees the main icon.


    I am so glad that I am not the only one, it took me months to find this thread.

    What I am looking for is a solution that permanently embeds icons so that it can be seen as shown in kleinma's screenshot.

    Once done this can be also then utilized in Windows 7 API CodePack's IconReference class:

    ZScreen.exe, 0
    ZScreen.exe, 1
    ZScreen.exe, 2
    ZScreen.exe, 3

    Thanks
    McoreD

  8. #8
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Re: icon question



    With a helpful post from Keeron from Windows 7 API Code Pack issues page, I have managed to achieve the above.

    http://code.msdn.microsoft.com/Windo...?WorkItemId=15

    Cheers,
    McoreD

  9. #9
    PowerPoster motil's Avatar
    Join Date
    Apr 2009
    Location
    Tel Aviv, Israel
    Posts
    2,143

    Re: icon question

    sorry for changing the topic but, ~*McoreD*~ is that an obivion screen shot that you set as your wallpaper ? :S
    * Rate It If you Like it

    __________________________________________________________________________________________

    "Programming is like sex: one mistake and you’re providing support for a lifetime."

    Get last SQL insert ID

  10. #10

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: icon question

    Quote Originally Posted by ~*McoreD*~ View Post


    With a helpful post from Keeron from Windows 7 API Code Pack issues page, I have managed to achieve the above.

    http://code.msdn.microsoft.com/Windo...?WorkItemId=15

    Cheers,
    McoreD
    I would imagine from the sound of that it is a Windows 7 only solution, right?

  11. #11
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Re: icon question

    kleinma,

    Since we are using a native win32 resource script, I am guessing it will work for XP, Vista as well.

  12. #12
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Re: icon question

    Quote Originally Posted by motil View Post
    sorry for changing the topic but, ~*McoreD*~ is that an obivion screen shot that you set as your wallpaper ? :S
    @motil

    It was just a Windows 7 default wallpaper

    @kleinma

    Here is a screenshot from XP:


  13. #13
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,621

    Re: icon question

    have you tried assigning an icon to a form? I was able to embed two icons in a vb6 exe by assigning icons to two different forms.
    My light show youtube page (it's made the news) www.youtube.com/@artnet2twinkly
    Contact me on the socials www.facebook.com/lordorwell

  14. #14

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: icon question

    I was just asking about Windows 7 only because you mentioned you were using "Windows 7 API CodePack's IconReference"

  15. #15
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Re: icon question

    kleinma, my needs arised because of the Windows 7 API CodePack because the IconReference required native win32 icons to be present in an exe/dll.
    Last edited by ~*McoreD*~; Aug 27th, 2009 at 05:02 PM.

  16. #16
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: icon question

    If you add the icons to your project (just as files in the solution explorer) and you set it to Embedded resource, doesn't that add them to the icon tree in the exe? I'm pretty sure that's how I did it in VS 2002/2003 and I still do that with MDB's in VS 2005/2008
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  17. #17
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: icon question

    I also found this too: http://www.codeproject.com/KB/vb/embeddedresources.aspx

    If it helps anyone
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  18. #18
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,388

    Re: icon question

    The only way that I know how to do it in 2008 is after you compiled your app do the following (think it is the same in 2003):

    Build your app
    Click the show all files button
    Navigate to your app .exe in the Debug release folder in the Solution explorer
    Double click on your exe
    Rightclick on icon
    Click add icon

    ... but this method is far from ideal as you need to do it each time

    - let me know if there is a better way

    Kris

  19. #19
    Addicted Member
    Join Date
    Apr 2003
    Location
    Australia
    Posts
    252

    Re: icon question

    JuggaloBrotha, I doubt it is that simple to display icons as kleinma mentioned in the first post:



    The *only* way I have seen so far is by using a Compiled Resource Script

    I have transformed the MHT file to a wiki page here: http://code.google.com/p/mcorelabs/w...NativeResource
    Last edited by ~*McoreD*~; Aug 28th, 2009 at 05:26 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width