Question How to make a Icon Changer ?

Romeo12

Active member
Joined
Jul 15, 2009
Messages
25
Programming Experience
Beginner
Hey guys, i want to know how to make a program in VB.NET that change a icon for a file ...

Like a simple Icon Changer !

And, do i need a stub for this ?

Anyone khnow how to make one ?

Any sources or tutorials for this ?
Thanks !
 
Last edited:
dosn't work ...

anyone !

in that 2'rd link ... didn't show you how to change the icon from that file ...

and in first link ... did not have any sense ...


another one ? do anyone have a project from a Icon changer ?
Well in the first link all you need to do is add this code:
VB.NET:
    Public Sub SetDefaultIcon(ByVal FileType As String, ByVal Icon As String)
        Dim rk As Microsoft.Win32.RegistryKey = ClassesRoot
        Dim rk1 As Microsoft.Win32.RegistryKey = ClassesRoot
        Dim ext As Microsoft.Win32.RegistryKey = rk.OpenSubKey(FileType)
        Dim regtype As String = ext.GetValue(String.Empty)
        ext = rk1.OpenSubKey(regtype, True).OpenSubKey("DefaultIcon", True)
        ext.SetValue(String.Empty, Icon)
        MessageBox.Show(ext.ToString)
    End Sub
And be sure to add the Imports Microsoft.Win32.Registry at the top. Then to change the associated icon for a file type, you simply call the sub:
VB.NET:
    Private Sub btnChangeIcon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChangeIcon.Click
        SetDefaultIcon(<File type as string here>, <Location of icon file here>)
    End Sub
In this case it's called from a button's click event.

How does that not make sense?
 
Yes i Imports Microsoft.Win32.Registry

and, i don't get how to save again that file, with the specific icon ...

Anyway, what i have to put in <File type as string here> adress from the file i want to change the icon ?
 
for the <File type as string here> it's the file type's extension, ie: ".gif" for gif images, ".txt" for text files, ".html" for html files.
 
for the <File type as string here> it's the file type's extension, ie: ".gif" for gif images, ".txt" for text files, ".html" for html files.

...................... but you need .ICO to change the file ICON ....


anyway, if i put there .ico, then, HOW did this code will change the icon from that FILE ?

....
:confused:
 
...................... but you need .ICO to change the file ICON ....


anyway, if i put there .ico, then, HOW did this code will change the icon from that FILE ?

....
:confused:
You have yet to realize that there's two file types going on here, the first one is never .ico it's the type (file extension) you want your icon to be displayed on. The second one is the icon file's full path.
 
You have yet to realize that there's two file types going on here, the first one is never .ico it's the type (file extension) you want your icon to be displayed on. The second one is the icon file's full path.

lol, i know, ico is the extension ...

no, i don't want to be displaied, i want tonly to change a .exe icon to a icon that is selected by ME !
 
Ah, so now the real goal comes out, you want to change the icons in other exe files, which is much harder to do. I don't know how to do it in vb.net and I don't really have the time for it till after the weekend, but I did find a program that seems to already do this: Exe Icon Changer -- Change icon in exe, dll, folder, driver, other type executable file; Replace/Extract exe icon!

lol ...real goal was in the first post ... but, NVM !


Yes, there are a lot of programs that do that, but i want to insert that into my program !

i thinked ... but i don't khnow ....

maybe, to copi the program ( input to output) and entries into a STUB, and there to change me.icon with the icon selected by me, but i think the stub will change the program proprietises ( program that i want to change the icon )
 
lol ...real goal was in the first post ... but, NVM !


Yes, there are a lot of programs that do that, but i want to insert that into my program !

i thinked ... but i don't khnow ....

maybe, to copi the program ( input to output) and entries into a STUB, and there to change me.icon with the icon selected by me, but i think the stub will change the program proprietises ( program that i want to change the icon )
This is semantics at this point, but check out your post #3 to stated that you wanted to change the associated icon for a file (answering JMC's windows associated icon) you never mentioned tampering with binary files, which is the exact opposite in your post #3 reply. Until now I thought you were wanting the windows associated icon to be changed, which is easy. Changing a binary's icon is much more difficult, which wasn't mentioned until now in post #12
 
Back
Top