Link to home
Start Free TrialLog in
Avatar of pj_harro
pj_harro

asked on

shell32.dll icon for HTA

I have looked pretty hard for this but just can't seem to find the answer i need.

All i want to do is use one of the icons in shell32.dll for my hta

Code snip:
-------------------------------------------------------------
<head>
     <title></title>
     <HTA:APPLICATION ID="oHTA"
     BORDER="thick"
     INNERBORDER="yes"
     SHOWINTASKBAR=yes
     SCROLL=Yes
     APPLICATIONNAME="HTA Verification"
     NAVIGABLE="yes"
     ICON="res://shell32.dll/2/230"
     >
</head>
-------------------------------------------------------------

The above "icon=" bit is what i thought might work.. but nope
ASKER CERTIFIED SOLUTION
Avatar of merowinger
merowinger
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pj_harro
pj_harro

ASKER

you mean extract the icon as a .ico file and link that?
yes use an own .ico file - exaclty
aw crap, i dont want to use another file. but if i cant then i cant.
You can extract the icons from most dll files using an app like this one.

http://www.online-tech-tips.com/free-software-downloads/how-to-extract-icons-from-exe-dll-ocx-and-cpl-files/

You can then try to imbed the icon into your hta file from a cmd prompt by doing the following.

type youricon.ico>newhta.hta
type yourhtafile.hta>>newhta.hta

I believe it only works well with icons with certain resolution, but you can give it a try.
Oh, and I forgot.  After you imbed the icon, you need to modify the hta code to reflect the imbeded icon like so.

<HTA:APPLICATION ID="oHTA"
    ICON="#"  
   >
Thanks TakedaT. I have used this method with other HTAs and it works well. Problem is i need to be able to read the HTA in question using another vbscript, and once it's embeded with an icon it doent read using readline method
Im not sure why it wouldnt work.  What problems were you running into?
Here's a sample HTA that works for me in XP:
<html>

<script language="vbscript">
	
window.resizeTo 500,200
	

document.write "<HTA:APPLICATION" & vbCrLf & _
				"ID=""objTest""" & vbCrLf & _
				"ApplicationName=""Test"""	& vbCrLf & _
				"ICON=""res://shell32.dll/2/230""" & vbCrLf & _
				"/>"


</script>


<body>
This works in WinXP only.
<br><br>
Here is an image:
<br>
<img src="res://shell32.dll/2/130">
</body>

</html>

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Nice jostrander,

Check out this slightly modified version. Some odd stuff in that dll


<head>
     <title></title>
     <HTA:APPLICATION ID="oHTA"
     BORDER="thick"
     INNERBORDER="yes"
     SHOWINTASKBAR=yes
     SCROLL=Yes
     APPLICATIONNAME="HTA Verification"
     NAVIGABLE="yes"
     ICON="res://shell32.dll/2/230"
     >
</head>

<script language="vbscript">

For i = 1 to 500
     sHTML = sHTML & "(" & i & "):<img src=""res://shell32.dll/2/" & i & """> <BR>"
Next

Sub MyRun()
     document.getElementById("iconSpan").InnerHTML = sHTML
End Sub

</script>

<html>
<body>
<form name="frmMyForm">

<input class="input" type="button" value="Run" name="btnMyRun" onclick="MyRun">
<br>
<span id=iconSpan></span>

</body>
</html>

Open in new window

I was so busy thinking of a workaround for the original issue, that I didn't even realize your example worked fine on my XP box, didn't even have to do the document.write...

I think the merged icon approach is probably best anyway... seems to work fine on my XP and Win7.

There certainly is a lot of stuff in that DLL.  Not sure if you've used it before or not, but Resource Hacker is a great tool for viewing/replacing resources in DLL/EXE files.
http://www.angusj.com/resourcehacker/

Joe
You are right.

This may seem odd, but the reason i didn't want to go for a merged icon is because my hta actually saves over itself.
1. It loads its own file into an array
2. changes some text
3. deletes itself (yeh it can)
4. writes a new "changed" version of itself

This all works fine untill i embed an icon into it, then I get "invalid procedure call or arguement" for my writeline into the new file, funny enough after this has failed the .hta is blank :)
Joe,

well there u go. I grabbed the binary stuff from your example above and now i can read in and change the merged icon hta.

Nice work :)
hmmm, on further investigation i am conderned with this:

"The behavior of the AscB function depends on the byte ordering of the hardware platform, and the number of bytes used to represent Unicode characters in the system software. The function will produce different results on each supported operating system. Use with caution. The described behavior pertains to the Win32 version."

Maybe i'll just bite-the-bullet and not worry about an icon.
Sometimes I like to turn the sysmenu off, so I have no icon and then I add a button to the hta to close it.
Thanks for you help Joe.

I am splitting the poitns between merowinger and jostrander.

Merowinger answered my origianl question succinctly, but jostrander helped my understand it and gave me other options