如何有效修改Hta显示的Icon图标和Hta标题栏状态栏图标

因项目需求,需要制作一个客户端工具,由于开发时间的原因,我们选择使用hta的方式来开发,一切进展顺利,美中不足就是hta的icon显示图标不太美观,更惨的是它没有更换图标的选项,经过一番搜索实践,终于改变了hta的icon显示图标,当然,hta的标题栏和状态栏图标设置就很简单了!

 

hta项目文件结构

【项目文件夹】

├ 【source】

│      ├  要执行的hta文件.hta

│      └  要给这个hta使用的icon图标.ico

└ 【其他项目需要的目录(与设置hta图标无关)】

 

设置hta的标题栏和状态栏图标

在hta文件的<HTA:APPLICATION ...>中添加如下属性:

ICON="要给这个hta使用的icon图标.ico"

 

设置hta的显示图标

给hta设置显示图标目前为止貌似都没有直接的方式,网上搜索到一些方式:

exeScript

使用exeScript必须是ANSI格式才行,否则乱码,而且转换成exe后不能支持AJAX的后台操作,会弹出IE窗口,失败...

Netbox

没有试过

WinRar

突破就是它了!

实现原理:利用WinRar的创建自解压格式压缩文件来打包hta项目包并且给创建后的文件添加一个ICON图标

1.在【项目文件夹】上点右键,选择WinRar选项中的“添加到压缩文件”

2.在弹出的对话框【压缩选项】中勾选“创建自解压格式压缩文件”

3.切换到【高级】选项卡,单击“自解压选项”

4.在【自解压选项】对话框中进行如下操作:

4.1 在“解压路径”中填写一个预计客户端存在的路径,如:c:\

4.2 在“解压后运行”中填写我们那个hta文件解压后的路径,如:c:\项目文件夹\要执行的hta文件.hta

4.3 切换到【模式】选项卡,在“安静模式”中选中“全部隐藏”,在“覆盖方式”中选中“跳过已经存在的文件”

4.4 切换到【文本和图标】选项卡,在“从文件加载自解压文件图标”中点【浏览】按钮,选择我们要使用的hta图标ICON文件,如:在弹出的图标文件选择框中打开【项目文件夹】->【source】,然后选中“要给这个hta使用的icon图标.ico”这个图标

4.5 确定

5. 确定

执行完上述操作后,将会生成一个显示着我们要使用的图标的exe文件,双击执行看看,马上就弹出了我们要执行的那个hta文件,看它的标题栏和状态栏图标,也OK了,最终,蒙混过关。

如果大家发现其他更好的给hta文件更改显示图标的方式,还望共享学习一下!

原创文章,转载请注明出处http://www.w3cgroup.com/article.asp?id=254

 

参考:<HTA:APPLICATION ...>属性介绍

该标签需写入到<head></head>内,写法形如:

<HTA:APPLICATION

 ID="W3CGROUP"

属性="属性值"

>

applicationName
Sets or retrieves the name of the HTML Application (HTA).
设置或者获取HTA的名称
值:自定义

border
Sets or retrieves the type of window border for the HTML Application (HTA).
设置边框模式
值为:thick/thin/dialog/none

borderStyle
Sets or retrieves the style set for the content border within the HTML Application (HTA) window.
设置边框样式
值为:normal/complex/raised/static/sunken

caption
Sets or retrieves a Boolean value that indicates whether the window is set to display a title bar or caption, for the HTML Application (HTA).
是否显示标题栏
值为yes/no

commandLine
Retrieves the argument used to launch the HTML Application (HTA).
用于获取当前HTA应用程序的路径

contextMenu
Sets or retrieves whether the context menu is displayed when the right mouse button is clicked.
设置或者获取反键菜单是否可用
值为yes/no

icon
Sets or retrieves the name and location of the icon specified in the HTML Application (HTA).
设置HTA的图标路径
值为一个图标路径

innerBorder
Sets or retrieves whether the inside 3-D border is displayed.
是否显示内边框
值为yes/no

maximizeButton
Sets or retrieves a Boolean value that indicates whether a Maximize button is displayed in the title bar of the HTML Application (HTA) window.
是否显示最大化按钮
值为yes/no

minimizeButton
Sets or retrieves a Boolean value that indicates whether a Minimize button is displayed in the title bar of the HTML Application (HTA) window.
是否显示最小化按钮
值为yes/no

navigable
Sets or retrieves whether linked documents will be loaded in the main HTA window or in a new browser window.
设置HTA程序中的链接是在浏览器中打开,还是
在当前窗口打开.
值为yes/no

scroll
Sets or retrieves whether the scroll bars are displayed.
是否显示滚动条
值为yes/no/auto

scrollFlat
Sets or retrieves whether the scroll bar is 3-D or flat.
设置滚动条是3D样式的,还是2D平板样式
值为yes/no

selection
Sets or retrieves whether the content can be selected with the mouse or keyboard.
设置HTA中的文字是否可选
值为yes/no

showInTaskBar
Sets or retrieves a value that indicates whether the HTML Application (HTA) is displayed in the Windows taskbar.
设置HTA是否显示在任务栏上
值为yes/no

singleInstance
Sets or retrieves a value that indicates whether only one instance of the specified HTML Application (HTA) can run at a time.
设置同一个HTA能否以多窗口模式打开
值为yes/no

sysMenu
Sets or retrieves a Boolean value that indicates whether a system menu is displayed in the HTML Application (HTA).
设置是否显示系统的几个按钮,最大化,最小化
值为yes/no

version
Sets or retrieves the version number of the HTML Application (HTA).
设置HTA版本信息

windowState
Sets or retrieves the initial size of the HTA window.
设置HTA打开时的模式
值为normal/maximize/minimize



[本日志由 dh20156 于 2009-06-04 09:28 AM 编辑]
文章来自: DHTML精英,WEB前端专家!
引用通告: 查看所有引用 | 我要引用此文章
Tags: hta
评论: 2 | 引用: 0 | 查看次数: 3276
回复回复心云意水[2009-06-26 11:16 AM | del]
话说,改HTA的图标,用rar那招,如果只是单个的hta,的确可以凑合,但是我上次写了一个东西,还附带了很多其他的东西,用rar会死人的!-_-

后来解决方法是,用安装打包工具,把所有东西打包,然后发给客户的时候,让他们去安装,在开始菜单、桌面上弄个快捷方式,糊弄下。。。。^^
回复回复路过的[2009-06-09 09:09 PM | del]
正好需要.谢谢楼主详细介绍
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 关闭 | [img]标签 关闭