Change Extensions Icons
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
comathi wrote:#troop
Once you have used those two lines of code both visualtech and I have sent you, use this to set an icon for your extension:
Code: Select allMake sure you replace "Hello" with the name of the name of the folder you created previously (with the "\shell\command" line) and replace "filename.ico" with the filename of your icon file you wish to use.My.Computer.Registry.ClassesRoot.CreateSubKey("Hello\DefaultIcon").SetValue("", """" filename.ico"", 0", Microsoft.Win32.RegistryValueKind.ExpandString)
As with everything when editing the registry, you may need to restart your computer so the changes can take place. Here's what it did for me:
Thhx so much, hello should be my extension?
("extension\DefaultIcon") ??
also does this need run as admin i can do it my self but does it? also should it be a 1 time run code or doesnt matter if it repeats it on each form load? loove;
If your extension's name is "extension", then the full code you'll be using is this:
As far as I know, running the code multiple times won't hurt anything
Code: Select all
All of this should be run as admin, and may require a computer restart since you're playing around with the registry. My.Computer.Registry.ClassesRoot.CreateSubKey(".extension").SetValue("", "Extension", Microsoft.Win32.RegistryValueKind.String)
My.Computer.Registry.ClassesRoot.CreateSubKey("Extension\shell\open\command").SetValue("", Application.ExecutablePath & " ""%l"" ", Microsoft.Win32.RegistryValueKind.String)
My.Computer.Registry.ClassesRoot.CreateSubKey("Extension\DefaultIcon").SetValue("", """" filename.ico"", 0", Microsoft.Win32.RegistryValueKind.ExpandString)
As far as I know, running the code multiple times won't hurt anything

comathi wrote:If your extension's name is "extension", then the full code you'll be using is this:ThanX comathi loove;
Code: Select allAll of this should be run as admin, and may require a computer restart since you're playing around with the registry.My.Computer.Registry.ClassesRoot.CreateSubKey(".extension").SetValue("", "Extension", Microsoft.Win32.RegistryValueKind.String) My.Computer.Registry.ClassesRoot.CreateSubKey("Extension\shell\open\command").SetValue("", Application.ExecutablePath & " ""%l"" ", Microsoft.Win32.RegistryValueKind.String) My.Computer.Registry.ClassesRoot.CreateSubKey("Extension\DefaultIcon").SetValue("", """" filename.ico"", 0", Microsoft.Win32.RegistryValueKind.ExpandString)
As far as I know, running the code multiple times won't hurt anything
Copyright Information
Copyright © Codenstuff.com 2020 - 2023