Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Icons

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,40107
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Icons
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Icons - 11/27/2006 8:05:55 PM   
  TNO


Posts: 1397
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Greetings,

Does anyone know how to determine the icon associated with a file type? for example, a harddrive icon is located at:

%SystemRoot%\system32\SHELL32.dll,2

is there a way to determine this through WSH? WScript.Shell.IconLocation  will let you set this property, but I want something generic.

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch
 
 
Post #: 1
 
 RE: Icons - 11/28/2006 12:31:55 AM   
  CaffeineAddiction

 

Posts: 144
Score: 0
Joined: 2/9/2005
From:
Status: offline
It would really depend on the file.  For instance, many applications have icon files embeded into there binary, while others point to an icon file located in its install directory, and still others point to random dll like the one you listed.  If you wanted to change all .txt files to a specific icon I would guess that that information would be kept in the registry ... however I would have to do some digging to be 100% on that

_____________________________

Thanks for Answering my Questions ... I hope my Answer to your questions help!

(in reply to TNO)
 
 
Post #: 2
 
 RE: Icons - 11/28/2006 1:56:09 AM   
  TNO


Posts: 1397
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Well, let me clarify a little. I'm making a UI file browser and I don't want to have to hold on to a separate set of images for each file type, instead I'd like to have the files  show the proper icons as defined by the dll/exe. I've been diggin a bit in the registry but can't find a list to refer to.

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to CaffeineAddiction)
 
 
Post #: 3
 
 RE: Icons - 11/28/2006 12:22:40 PM   
  Parabellum


Posts: 222
Score: 0
Joined: 11/12/2006
From: UK
Status: offline
if i understand your right... this shouldnt be too hard..

each file extension is listed unde HKEY_CLASSES_ROOT

eg

[HKEY_CLASSES_ROOT\.abc]
and it should also have a default value assigned to it

eg

[HKEY_CLASSES_ROOT\.abc]
@="ABC_File"

this relates to another key in classes root;

[HKEY_CLASSES_ROOT\ABC_File]

you can creat a subkey in this key called DefaultIcon

eg

[HKEY_CLASSES_ROOT\ABC_File\DefaultIcon]
and assign the default DWORD the correct path to the icon file


so the complete reg file would be.....

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.abc]

[HKEY_CLASSES_ROOT\.abc]
@="ABC_File"

[HKEY_CLASSES_ROOT\ABC_File]

[HKEY_CLASSES_ROOT\ABC_File\DefaultIcon]

[HKEY_CLASSES_ROOT\ABC_File\DefaultIcon]
@="C:\\Program Files\\somePRogram\\programl.exe,0"

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Hope that helps..

(in reply to TNO)
 
 
Post #: 4
 
 RE: Icons - 11/28/2006 10:44:28 PM   
  Fredledingue


Posts: 383
Score: 0
Joined: 5/9/2005
From:
Status: offline
TNO,

Are you using HTA as a UI?
If yes how are displaying the icon in the HTA?


_____________________________

Fred

(in reply to TNO)
 
 
Post #: 5
 
 RE: Icons - 11/28/2006 10:48:00 PM   
  CaffeineAddiction

 

Posts: 144
Score: 0
Joined: 2/9/2005
From:
Status: offline
Both HTAs and HTML can use .ico files just like using a .jpg or .gif

_____________________________

Thanks for Answering my Questions ... I hope my Answer to your questions help!

(in reply to Fredledingue)
 
 
Post #: 6
 
 RE: Icons - 11/29/2006 2:38:34 AM   
  TNO


Posts: 1397
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
quote:

TNO,

Are you using HTA as a UI?
If yes how are displaying the icon in the HTA?


Well, thats the problem Fredledingue.....I haven't figured that out yet. Instead of just displaying a list of files in a <DIV> tag with images (gif,jpg, etc), I tried to Embed the FileList control to kill 2 birds with one stone but it looks like you can't script this object (The FileList control is the object in every single folder that shows you your files)

<object id=FileList classid="clsid:1820FED0-473E-11D0-A96C-00C04FD705A2"  >
 <param name="Location" value="%THISDIRPATH%\folder">
 <param name="AlignLeft" value="1">
 <param name="AutoSize" value="7">
 <param name="AutoSizePercentage" value="100">
 <param name="AutoArrange" value="1">
 <param name="NoClientEdge" value="false">
 <param name="ViewMode" value="3">
</object>

Unless one of you old-school programmers can figure this out (I'm not too keen on creating type libraries to access dll's and make them functional..).

My second thought is to to look-up and reference an ico from a dll/exe from a filetype and display it using an activeX control (not sure which one yet )

If all else fails I'll have to rely on dynamically inserting the filename/images from VML (a.k.a recreate the icons so everything is in one file)

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to CaffeineAddiction)
 
 
Post #: 7
 
 RE: Icons - 11/29/2006 10:34:04 AM   
  Fredledingue


Posts: 383
Score: 0
Joined: 5/9/2005
From:
Status: offline
quote:

ORIGINAL: CaffeineAddiction

Both HTAs and HTML can use .ico files just like using a .jpg or .gif


Ok if you'v got the .ico files separatly. What about getting the icon from a dll or an exe file and display it in your hta/html?

That's the whole point TNO is talking about

______

TNO what's a VML file?

_____________________________

Fred

(in reply to CaffeineAddiction)
 
 
Post #: 8
 
 RE: Icons - 11/29/2006 4:41:42 PM   
  TNO


Posts: 1397
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
I didn't mean a VML file, I meant Vector Markup Language.

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to Fredledingue)
 
 
Post #: 9
 
 RE: Icons - 11/30/2006 9:44:26 PM   
  est

 

Posts: 39
Score: 0
Joined: 10/12/2006
Status: offline
There was ONCE a very useful Asyn Pluggable Protocol called: sysimage, and that's exactly what you wanted. But for some security reasons, Microsoft disabled sysimage:// and give up it permanently in IE7. So the only solution I could offer by far, is the res:// Asyn Pluggable Protocol:

Example:
In IE6, type

res://shell32.dll/3/6

es, IE displays some messy code. In fact, these messy characters are exactly the first icon in C:\Windows\Shell32.dll

So try ResHacker or eXeScope to open shell32.dll and find the ICON resource, export the first icon out and compare it with those gibberish in IE, your shall find these two quite the same.

At last it's easy to extrat the .ico content from shell32.exe, using ActiveXObject InternetExplorer.Application, or you can possibly use a hack like me in this post:

http://www.visualbasicscript.com/m_39737/tm.htm

_____________________________

Do NOT program in a programmer's way

(in reply to TNO)
 
 
Post #: 10
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Icons Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts