HTA テンプレート
汎用的なHTA(HTML Application)のテンプレート。
・template.hta
<html><!-- '***************************************************************************** '* '* NAME : '* '* DESCRIPTION : '* '* VERSION HISTORY: '* 1.0 yyyy-mm-dd Initial release by AUTHOR '* '***************************************************************************** --><head> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> <title> </title> <script language="VBScript"><!-- '************ Initialize window size ************ resize_window 300, 84 '***************************************************************************** '* Sub resize_window() '* '* Purpose: Resize a window to the specified width and height, '* and then set its position to center. '* Input : width - Sets the width of the window, in pixels (Integer) '* height - Sets the height of the window, in pixels (Integer) '* Output : None '***************************************************************************** Sub resize_window(width, height) If width > screen.width Then width = screen.width If height > screen.height Then height = screen.height window.resizeTo width, height window.moveTo (screen.width - width) / 2, (screen.height - height) / 2 End Sub --></script> <HTA:APPLICATION ID ="hta" APPLICATIONNAME="Application" VERSION ="1.0" ICON ="" BORDER ="normal" BORDERSTYLE ="normal" CAPTION ="yes" INNERBORDER ="yes" MAXIMIZEBUTTON ="yes" MINIMIZEBUTTON ="yes" SHOWINTASKBAR ="yes" SINGLEINSTANCE ="yes" SYSMENU ="yes" WINDOWSTATE ="normal" SCROLL ="no" SCROLLFLAT ="yes" SELECTION ="no" CONTEXTMENU ="yes" NAVIGABLE ="no" /> <script language="VBScript"><!-- '***************************************************************************** '* Sub Window_OnLoad() '* '* Purpose: Initialization tasks. '* Input : None '* Output : None '***************************************************************************** Sub Window_OnLoad() document.title = hta.applicationName & " v" & hta.version End Sub --></script> <style type="text/css"><!-- body { font-family : Verdana, Arial, Helvetica, Sans-serif; font-size : 14px; font-weight : normal; background-color: #ccffcc; color : #000000; margin : 0px 0px 0px 0px; } table { border-collapse: collapse; border-spacing : 0px; border-width : 0px; border-style : solid; } --></style> </head> <body> <table width="100%"> <tr height="40px"> <td align="center">Hello, World</td> </tr> </table> </body> </html>
・ウィンドウのリサイズ(window.resizeTo)は hta:application タグの前に記述しないと、起動時に一瞬通常サイズのウィンドウが表示されてしまう。
調べてみると、色々と奥が深い。
Related Posts
JavaScript版 HTAテンプレート
http://mogproject.blogspot.jp/2012/11/hta-template-with-javascript.html
References
HTA Template Generator
http://gallery.technet.microsoft.com/scriptcenter/HTA-Template-Generator-v1-af7273b1
0 件のコメント:
コメントを投稿