Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Lame icon association

Lame icon association

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jake Palmer
    wrote on last edited by
    #1

    Before I added any icons, the correct icon IDR_ABCTYPE was associated with all of my .abc files. I added another icon, and even though IDR_ABCTYPE is still exactly the same, all my .abc files are now being shown with this new icon, which should have nothing to do with them. any ideas what I've messed up?? X| thanks, Jake

    B A R M 4 Replies Last reply
    0
    • J Jake Palmer

      Before I added any icons, the correct icon IDR_ABCTYPE was associated with all of my .abc files. I added another icon, and even though IDR_ABCTYPE is still exactly the same, all my .abc files are now being shown with this new icon, which should have nothing to do with them. any ideas what I've messed up?? X| thanks, Jake

      B Offline
      B Offline
      Ben Burnett
      wrote on last edited by
      #2

      I think there are several ways of fixing this, not sure that will do the trick for you but here they are; 1) Fire up your registry editor and go to; HKEY_CLASSES_ROOT\.abc\ Check the '(default)' string entry, if its empty go to the sub-key 'DefaultIcon' and set the correct number. If it has a string in it, find the key it refers to ( from the '(default)' entry ); HKEY_CLASSES_ROOT\*the key*\ And do the same as above. BTW: this is only a temporary fix, you should use one of the others to make sure it will work properly on other PC's. 2) Pass '/Unregister' as a command line option to your application (if your using MFC) then re-run it to correct the associations. 3) In VC++ open up your executable as a resource file, check that the new icon you added is at the end of the icon resource list. If it is not, then you will need to play around with the resouce.h file and make the icon's ID larger than that of the document's. One of these should do the trick, but no promises. Ben Burnett --------- On the topic of code with no error handling -- It's not poor coding, it's "optimistic" ;)

      J 1 Reply Last reply
      0
      • J Jake Palmer

        Before I added any icons, the correct icon IDR_ABCTYPE was associated with all of my .abc files. I added another icon, and even though IDR_ABCTYPE is still exactly the same, all my .abc files are now being shown with this new icon, which should have nothing to do with them. any ideas what I've messed up?? X| thanks, Jake

        A Offline
        A Offline
        Andrew Peace
        wrote on last edited by
        #3

        Something I've found over time is that Explorer keeps an icon cache which can get a bit corrupted. You might try "Rebuild Icons" in TweakUI to fix this (if that is what the problem is); also it might be called "Repair Icons" or something - can't quite remember just off hand. > Andrew.

        1 Reply Last reply
        0
        • J Jake Palmer

          Before I added any icons, the correct icon IDR_ABCTYPE was associated with all of my .abc files. I added another icon, and even though IDR_ABCTYPE is still exactly the same, all my .abc files are now being shown with this new icon, which should have nothing to do with them. any ideas what I've messed up?? X| thanks, Jake

          R Offline
          R Offline
          Richard Bywater
          wrote on last edited by
          #4

          Have you problems with any other icons? I've had similar problems just using my system where icon associations kept changing to different icons... Otherwise if its just the ABC files that your having trouble with, sorry cant help... Richard.

          1 Reply Last reply
          0
          • B Ben Burnett

            I think there are several ways of fixing this, not sure that will do the trick for you but here they are; 1) Fire up your registry editor and go to; HKEY_CLASSES_ROOT\.abc\ Check the '(default)' string entry, if its empty go to the sub-key 'DefaultIcon' and set the correct number. If it has a string in it, find the key it refers to ( from the '(default)' entry ); HKEY_CLASSES_ROOT\*the key*\ And do the same as above. BTW: this is only a temporary fix, you should use one of the others to make sure it will work properly on other PC's. 2) Pass '/Unregister' as a command line option to your application (if your using MFC) then re-run it to correct the associations. 3) In VC++ open up your executable as a resource file, check that the new icon you added is at the end of the icon resource list. If it is not, then you will need to play around with the resouce.h file and make the icon's ID larger than that of the document's. One of these should do the trick, but no promises. Ben Burnett --------- On the topic of code with no error handling -- It's not poor coding, it's "optimistic" ;)

            J Offline
            J Offline
            Jake Palmer
            wrote on last edited by
            #5

            I think it must have something to do with the IDs of the icons, because I played around with them and was able to produce different incorrect results :) After enough frustration I deleted the icons and made bitmaps to display on my buttons instead, so that's working now and the icons are back to normal :rolleyes: Thanks for all of your help! Jake

            1 Reply Last reply
            0
            • J Jake Palmer

              Before I added any icons, the correct icon IDR_ABCTYPE was associated with all of my .abc files. I added another icon, and even though IDR_ABCTYPE is still exactly the same, all my .abc files are now being shown with this new icon, which should have nothing to do with them. any ideas what I've messed up?? X| thanks, Jake

              M Offline
              M Offline
              Michael Dunn
              wrote on last edited by
              #6

              It depends on what's stored in the DefaultIcon key. If it's "C:\path\to\your.exe,0" then the icon with the lowest ID (index 0) will be used. If you add icons that changes the relative order of the IDs, then what you're seeing can happen. You can change that to "C:\path\to\your.exe,-102" to use the icon with ID 102 (note the minus sign). --Mike-- http://home.inreach.com/mdunn/ A recent survey reports that 1/4 of all internet users in England surf for porn. The other 3/4 just didn't want to admit it.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups