 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Meloen Guest
|
Posted: Sat Feb 21, 2009 3:51 pm Post subject: Grab Icons from files |
|
|
How could I grab the icons from any file and show it in a Gui?
I'm using this code i made:
| Code: | #SingleInstance force
Shell32 = %A_WinDir%\system32\SHELL32.dll
I2 := 0
Gui, Add, Pic, vPicture w32 h32
Gui, Show, Autosize, TEST
If 1 <>
{
SplitPath, 1 ,,,ext
If (ext <> "")
{
PicIcon(ext)
}
Else
{
I2 := 4
Shell := 1
}
If Shell = 1
GuiControl,,Picture, *Icon%I2% %Shell32%
Else
GuiControl,, Picture, *Icon%I2% %I1%
}
return
GuiClose:
ExitApp
PicIcon(extension)
{
global
RegRead, key, HKEY_CLASSES_ROOT, .%extension%
RegRead, icon, HKEY_CLASSES_ROOT, %key%\DefaultIcon
StringSplit, I, icon, `,, "
If I1 = %SystemRoot%\System32\shell32.dll
Shell := 1
If I2 contains -
StringTrimLeft, I2, I2, 1
} |
When you drag any file on the script, it shows the icon.
The problem is that some files like ".bat" files have an icon index like -153 and the Gui doesn't accept them...
Any other ideas? |
|
| Back to top |
|
 |
jaco0646
Joined: 07 Oct 2006 Posts: 3113 Location: MN, USA
|
|
| Back to top |
|
 |
Dbof
Joined: 13 Jan 2009 Posts: 31
|
Posted: Sat Feb 21, 2009 7:52 pm Post subject: |
|
|
Thanks, it solved the problem with bat and txt files, but theres a problem with images:
.bmp
Path(shown by regedit): shimgvw.dll,1
But it shows another image...i opened the DLL with ResHack and saw whats the problem.
Theres a folder named "Icon", where Icon\2 is the wrong icon.
And theres a folder named "Icon group", where Icon Group\2 is the right icon.
This happens also with png(Index = 2), and jpg(Index = 3)
But now that, what is making me crazy
The script got a jpg-file and retrieved the icon of a png-file
The script got a png-file and retrieved the icon of a bmp-file.
What now?
Any ideas how to do it this way
EDIT: Sorry, i forgot to say that I am Meloen, but i have forgotten that i was registered! |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|