AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Icons

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
viciouskinid



Joined: 23 Jun 2007
Posts: 136

PostPosted: Sat May 17, 2008 7:01 am    Post subject: Icons Reply with quote

I was wondering how i could extract the icon from a .ahk file. the below doesnt work.

Gui, Add, Picture, w16 h16 icon1, C:\Users\......\Desktop\.........ahk

I know I could get the Icon from the AHK exe but this wont work for my purposes. i am making a drag and drop program where if you drag the icon into a gui it displays its icon. Any ideas?
Back to top
View user's profile Send private message
Trikster



Joined: 15 Jul 2007
Posts: 1194
Location: Enterprise, Alabama

PostPosted: Sat May 17, 2008 7:42 am    Post subject: Reply with quote

Crazy Scripting : IconEx v1.0 - Icon Explorer/Extractor - [SKAN]
_________________
ScriptPad/~dieom/dieom/izwian2k7/Ian/God

Back to top
View user's profile Send private message
viciouskinid



Joined: 23 Jun 2007
Posts: 136

PostPosted: Sat May 17, 2008 9:11 am    Post subject: Reply with quote

Ummm. that wont/doesnt work. I am talking about things like word documents, ahk files, picture files. I want to get the link of the files icon when the icon isnt stored in that specific file.
Back to top
View user's profile Send private message
Elesar



Joined: 28 Jun 2007
Posts: 95

PostPosted: Sat May 17, 2008 1:55 pm    Post subject: Reply with quote

That does work just fine.

Most windows icons are stored in the system32 folder in different DLLs, you just have to do some exploration.

Windows normally just associates a default icon for a file type, the file doesn't call for it specifically. (Unless it is a program, or related to a program, like how an AHK script gets its own icon).

If its an icon from a program, the exe will contain the image.

If you read about the IconEx, you will learn that you can search for an icon and save the image, then you can include that in a resources folder that your script will look into to call the picture that you saved.

Example:

-You want to use the Control Panel icon in your script.
-First, open IconEx and look into the SYSTEM32.DLL (The default on that IconEx v1.0 uses)
-Look through that and you will find the icon (It is icon group 22)
-Right-Click the icon and it will bring up a save-as dialog.
-Save the icon as whatever you want, wherever you want.
-Open you script and edit your Gui, Add section to reflect the location that you saved the icon to.
Back to top
View user's profile Send private message
viciouskinid



Joined: 23 Jun 2007
Posts: 136

PostPosted: Sat May 17, 2008 2:36 pm    Post subject: Reply with quote

ok still not what i am after. I understand where the icons are stored and how to get them myself but i want my script to do it. I dont want to have to save a heap of icons and have a look up table.

My question is that since for example a .doc file has a specific icon is it possible to have ahk to read that file and pick up the location of the icon directly.

My current script allows you to drag a file that contains icons into a gui and have that icon displayed. I want this to be possible with all files so i can drag any file into my gui.
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 1084
Location: switzerland

PostPosted: Sat May 17, 2008 2:49 pm    Post subject: Reply with quote

don't know you can use this
save the link in listview, shows icon from the program/link
http://www.autohotkey.com/forum/topic26888.html
Back to top
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Sat May 17, 2008 3:16 pm    Post subject: Reply with quote

The paths to the icons associated with file extensions are in the registry: HKEY_CLASSES_ROOT > file extension > DefaultIcon

So, extract the paths from the registry and use them with Gui, Add.

HTH
Back to top
jaco0646



Joined: 07 Oct 2006
Posts: 582
Location: MN, USA

PostPosted: Sat May 17, 2008 3:38 pm    Post subject: Reply with quote

n-l-i-d wrote:
extract the paths from the registry

That's what I did for my MRU script. However, since the registry uses Resource IDs (which AHK can't handle yet) Lexikos made a function with the necessary DLLCalls: Reference negative icon numbers.
_________________
http://autohotkey.net/~jaco0646/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group