Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 13th, 2009, 10:20 PM
javaman javaman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2007
Posts: 33 javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 9 h 27 m 59 sec
Reputation Power: 5
WSH - Creating custom icons

Is it possible to create a .wsc icon handler, and how would I go about it?
I'm talking about the registry setting "ShellEx\IconHandler."

Reply With Quote
  #2  
Old August 14th, 2009, 12:45 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,880 Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 2 Days 8 h 47 m 8 sec
Reputation Power: 967
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Default Icons for Registered File Types

I think you may be hinting at overkill here. It seems to me that you would just like to change the system-wide default icon for .wsc files. Yes?

If that's so, then there's no need to create an icon handler. Icon Handlers are used to display dynamic icons based on some environmental status. The best example I can think of is the Recycle Bin. It displays one icon when it's empty and another when it is not. This icon is dynamically changed by means of an Icon Handler (which involves some fairly in-depth programming ability).

If you simply want to change the default icon for a registered file type, there's no need to go through all of that. It's much simpler.

The first way to change the icon is through the Windows UI.
Method 1: Change the Default Icon for a Registered File Type:
  1. Open My Computer and choose Folder Options... from the Tools menu.
  2. Select the File Types tab in the Folder Options dialog.
  3. Locate and select the file type you wish to change the default icon for in the Registered File Types: box and then press the Advanced button.
  4. In the Edit File Type dialog, press the Change Icon... button.
  5. Press the Browse... button and locate the resource that contains the icon you wish to use.
  6. Select the icon in the box below and press the OK button.
  7. Press OK to close all remaining dialogs.
The second method of changing the default icon for a registered file type involves editing the Windows Registry.
Method 1: Change the Default Icon for a Registered File Type:
  1. Press Start and then Run... to open the Run dialog box.
  2. Enter regedit and press OK to launch the Microsoft Registry Editor.
  3. In the left pane, navigate to the key that matches the file extension for the file type you wish to change the icon for under the HKEY_CLASSES_ROOT branch. e.g.
    HKEY_CLASSES_ROOT\.wsc
  4. In the right pane, note the Data component for the (Default) string value. e.g. For .wsc files, the Data component will say scriptletfile.
  5. Navigate to the key matching the value you just found under the HKEY_CLASSES_ROOT branch. e.g.
    HKEY_CLASSES_ROOT\scriptletfile
  6. Expand this key and select the DefaultIcon key.
  7. Edit the (Default) string value with the location of the new icon resource you wish to use. e.g.
    C:\WINDOWS\system32\scrobj.dll,0
  8. Close the Microsoft Registry Editor. You may need to rebuild the Icon Cache or restart Windows for changes to take effect.
Alternatively, you can use a .reg file similar to the one below.
REG Code:
Original - REG Code
    Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\scriptletfile\DefaultIcon] @="C:\\WINDOWS\\system32\\scrobj.dll,0"
__________________
Don't like me? Click it.

Scripting problems? Windows questions? Ask the Windows Guru!

Stay up to date with all of my latest content. Follow me on Twitter!

Help us help you! Post your exact error message with these easy tips!

Last edited by Nilpo : August 14th, 2009 at 12:47 AM.

Reply With Quote
  #3  
Old August 14th, 2009, 02:10 PM
javaman javaman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2007
Posts: 33 javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 9 h 27 m 59 sec
Reputation Power: 5
Thanx, I've done that plenty of times. I'm talking about dynamic icons. My example is MicroSoft Word's html files which have an icon of their own, different from regular html files. I read a little about the icon handler, and saw that windows will call the component listed in the registry and call certain methods in it. I just don't know if a .wsc com object qualifies, or if I'd need a .dll written in C.
Truth to be told, VB.NET is not far beyond my scope, although it's not my mother tongue, as my screen name suggests. So if that's what I need, how would I do it there?

Reply With Quote
  #4  
Old August 14th, 2009, 02:15 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,880 Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 2 Days 8 h 47 m 8 sec
Reputation Power: 967
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
In that case, yes, you would need a COM object that exposes the correct interfaces. (Which excludes a .wsc, unfortunately.) You can learn more here.

Creating Icon Handlers

Reply With Quote
  #5  
Old August 14th, 2009, 05:48 PM
javaman javaman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2007
Posts: 33 javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level)javaman User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 9 h 27 m 59 sec
Reputation Power: 5
OK, I posted in the .net forum already. But I'm wondering if it would be possible to mimic any necessary interface. How should Windows know the difference? I can add any method/property that's needed. Or I can create another .wsc to fill that role.

Reply With Quote
  #6  
Old September 19th, 2009, 09:29 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,880 Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)Nilpo User rank is General (90000 - 100000 Reputation Level)  Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1Folding Points: 214558 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Week 2 Days 8 h 47 m 8 sec
Reputation Power: 967
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Quote:
Originally Posted by javaman
OK, I posted in the .net forum already. But I'm wondering if it would be possible to mimic any necessary interface. How should Windows know the difference? I can add any method/property that's needed. Or I can create another .wsc to fill that role.
The problem is that you need an actual interface. There's no way to create your own interfaces in WSC as you would with compiled code.

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > WSH - Creating custom icons


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek