2

I'm writing a little program (in C#) that allows me to make a list of games and sort these by specific categories, but because of the way Steam adds shortcuts to your games (via a .url file that redirects to a steam link) I have to extract them using the code found on this microsoft support page:

https://support.microsoft.com/en-us/help/319350/how-to-use-the-shgetfileinfo-function-to-get-the-icons-that-are-associated-with-files-in-visual-c-.net

However, with this code, I run into the issue that the little shortcut arrow is put upon the icon, which I'd rather avoid for aesthetic reasons. I've Googled the issue plenty, but the only results that came up were ways to remove all shortcut arrows from my computer via registry changes, which I'm not interested in. I'd be very grateful if someone had a solution to this issue.

Distractionz
  • 129
  • 5
  • If you're looking for the icon for the application, you should be able to follow the .lnk to the actual .exe and then extract the icon. https://stackoverflow.com/questions/13079569/how-do-i-get-the-path-name-from-a-file-shortcut-getting-exception and https://stackoverflow.com/questions/462270/get-file-icon-used-by-shell – TyCobb Jun 06 '17 at 19:55
  • you want to remove shortcut from the icon which you have, if I'm understanding this correctly ? – ISHIDA Jun 06 '17 at 19:57
  • @TyCobb the issue with the .lnk that Steam uses is that it leads through an url, which (as far as I know) doesn't allow me to find the actual .exe – Distractionz Jun 06 '17 at 20:00
  • @ISHIDA yes, I think that that is the issue. It has a small arrow in the bottom left corner that I want to have removed. – Distractionz Jun 06 '17 at 20:02
  • @Distractionz That sucks. Had no idea. =/ – TyCobb Jun 06 '17 at 20:04
  • @TyCobb Indeed, but thanks anyways! :) – Distractionz Jun 06 '17 at 20:06
  • It is a specific option for SHGetFileInfo(), SHGFI_ADDOVERLAYS. We can't see you using it. Or not using it. What the heck was the point of that?? – Hans Passant Jun 06 '17 at 20:36
  • @HansPassant I assume you mean I haven't showed my code, which is because I quite much copied the code given in the link above. I am not very knowledgeable of how that code exactly works beyond some of the basic logics of it, so I don't know exactly what options it has and how to use them. If you do know what I am doing wrong, please do feel free to tell me how to do it right. – Distractionz Jun 06 '17 at 20:45
  • @HansPassant After double checking the information on SHGetFileInfo, I indeed found the option SHGFI_ADDOVERLAYS, however I do not see that being used in the given code, so I don't think it actually has anything to do with that. Again, if you do understand what is wrong with the given code in my use case, I would love to see what it is that I am doing wrong. – Distractionz Jun 06 '17 at 21:13

2 Answers2

0

I tried to remove the short-cut icon it's not possible unless you edit the registry. i tried to copy the application to different folder but the application doesn't work has it doesn't have any reference. I tried to create a icon using Photoshop and tried to change the icon it still adds the short cut icon to it. There are "Ultimate windows tweaker" which removes the shortcut on all the icons. I would say it's not possible to remove on single application and if you check the properties of the shorcut icon you would see the "start in" linking to main application.

ISHIDA
  • 4,700
  • 2
  • 16
  • 30
0

Only tested on Windows 7HP SP1 - Consider setting system restore points before and after (even this short process) just to be safe

Removing those pesky shortcut icon arrows once and for all:

  1. Modify Registry with the popular Shell Icons settings that most folks find on the net to address this problem [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons] (The -50 string value modification). If you're unfamiliar, Google it, and you'll learn that the Registry modification procedure is actually pretty easy to do. (There are also ready-made .reg files available which makes this step easier and repeatable - look for them in your search results)

  2. Delete C:\Users\YourUserName\AppData\Local\Iconcache.db file (the file is hidden, so set your file viewer to show hidden files so you can see and delete it)

  3. Reboot and the icons should return good with no shortcut arrows showing

(If you stop at this point, like I did and most folks do, the shortcut icons will only look good until the next reboot or logoff event, after which they will return as black or have other issues.)

  1. Create an Iconcache.db dummy file with any text editor (just type in blah blah or whatever in the text editor), save it as Iconcache.db and then set the attributes to Read Only, Hidden, and also remove ALL SYSTEM privileges to the file (easy to do - just right click the file, choose properties, and make the changes in the General and Security tabs)

  2. Put your new dummy file in the C:\Users\YourUserName\AppData\Local\ directory (where you deleted the file in step 2)

Done! You can now reboot and/or log off indefinitely and the shortcut icons will always return good with no further action required - ever!!!

Summary:

  1. Make sure Registry has Shell Icons mod
  2. Delete existing ~local\Iconcache.db file (file is hidden)
  3. Reboot
  4. Create dummy Iconcache.db file and set attributes
  5. Put dummy file in ~local directory
Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108