home *** CD-ROM | disk | FTP | other *** search
- <html>
- <head>
- <META http-equiv="Content-Type" content="text/html; charset=utf-8" >
- <!--
- ' ------------------------------------------------------------------------------
- ' Filename: toast.hta
- ' ------------------------------------------------------------------------------
- ' Description: Produces Messenger Style Toast Popups above the SysTray
- ' ------------------------------------------------------------------------------
- ' Version: 1.0
- ' Notes:
- ' ------------------------------------------------------------------------------
- ' Copyright (C) Microsoft Corporation 2005, All Rights Reserved
- ' ------------------------------------------------------------------------------
- -->
- <title> </title>
-
- <bgsound id="backgroundSound" src="toast.wav" loop="0">
- <script id="toast" language="vbscript">
- <!--
- Option Explicit
-
- ' declare variables and constants
- Dim Debug, iTimerId, iCount, iSeconds, iSession
- Const TOASTWIDTH = 280
- Const TOASTHEIGHT = 120
- Const TOASTOFFSETX = 5
- Const TOASTOFFSETY = 5
-
- ' ------------------------------------------------------------------------------
- ' Name: Setup()
- ' ------------------------------------------------------------------------------
- ' Purpose:
- ' ------------------------------------------------------------------------------
- Sub Setup()
- Dim oWMIService, colProcesslist, oProcess, bMagnify
- bMagnify = False
-
- ' set debugging variable
- Debug = False
-
- ' if we are not in debug mode, ignore all errors
- If Not(Debug) Then On Error Resume Next
-
- ' set the application size and initial position
- 'Self.ResizeTo 180, 180
- Self.ResizeTo TOASTWIDTH, TOASTHEIGHT
-
- ' Check whether magnifier is running
- Set oWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
- Set colProcesslist = oWMIService.ExecQuery("Select * from Win32_Process Where Name = 'magnify.exe'")
- For Each oProcess in colProcesslist
- Self.MoveTo Screen.availWidth-TOASTWIDTH+TOASTOFFSETX, Screen.availHeight-TOASTOFFSETY
- bMagnify = True
- Exit For
- Next
-
- If Not bMagnify Then Self.MoveTo Screen.availWidth-(TOASTWIDTH+TOASTOFFSETX), Screen.availHeight-(TOASTHEIGHT+TOASTOFFSETY)
- End Sub
-
- ' ------------------------------------------------------------------------------
- ' Name: Main()
- ' ------------------------------------------------------------------------------
- ' Purpose:
- ' ------------------------------------------------------------------------------
- Sub Main()
- Dim sCmdLine, iTempSec, iSpace
-
- iCount = 0
- iSeconds = 60
-
- ' work out what was passed
- sCmdLine = oToast.CommandLine
-
- iSpace = Len(sCmdLine) - InStrRev(sCmdLine, " ")
-
- ' ~~~ Ensure that a command-line parameter was passed, and use it to set time remaining
- If iSpace <> 0 Then
- iTempSec = CInt(Right(sCmdLine, iSpace))
-
- If iTempSec <> "" Then
- iSeconds = iTempSec
- iSession = iTempSec
- End If
- End If
-
- ' position divs based on constants, can not be done in style sheet
- btnClose.style.left = TOASTWIDTH-16
- divTitle.style.width = TOASTWIDTH-26
- tabMessg.style.width = TOASTWIDTH-10
- tabMessg.style.height = TOASTHEIGHT-35
-
- ' update the message
- Call SetMessage()
-
- ' execute TimedSub() every 1000 milliseconds
- iTimerId = Self.SetInterval ("Countdown()", 1000)
- End Sub
-
- ' ------------------------------------------------------------------------------
- ' Name: Countdown()
- ' ------------------------------------------------------------------------------
- ' Purpose: Update the countdown timer
- ' ------------------------------------------------------------------------------
- Sub Countdown()
-
- 'If you replace this code make sure it works!
- If iSeconds = 280 then Self.Close
- If iSeconds = iSession - 30 then Self.Close
-
- If iSeconds > 0 Then
- iSeconds = iSeconds - 1
- Else
- Self.Close
- End If
-
- ' update the message
- Call SetMessage()
- End Sub
-
- ' ------------------------------------------------------------------------------
- ' Name: SetMessage()
- ' ------------------------------------------------------------------------------
- ' Purpose: Update the countdown timer
- ' ------------------------------------------------------------------------------
- Sub SetMessage()
- Dim iMins, iSecs
-
- ' calculate mins and seconds
- iMins = Int(iSeconds / 60)
- iSecs = iSeconds - (iMins * 60)
-
- ' update the div
- If iMins <> 1 Then
- divMessage.innerHTML = resPreMin.innerText & CStr(iMins) & resPostMin.innerText & CStr(iSecs) & resPostSec.innerText
- Else
- divMessage.innerHTML = resPreMin.innerText & CStr(iMins) & resPostMin1.innerText & CStr(iSecs) & resPostSec.innerText
- End If
- End Sub
-
- ' setup location and size before hta is displayed
- Call Setup()
- -->
- </script>
-
- <style type="text/css">
- body
- {
- margin: 0px;
- padding: 0px;
- overflow: hidden;
- color: navy;
- background-image: URL(../graphics/toast.gif);
- }
-
- .close
- {
- position: absolute;
- top: 8px;
- width: 11px;
- height: 11px;
- display: block;
- font-size: 1pt;
- }
-
- .title
- {
- position: absolute;
- top: 5px;
- left: 5px;
- height: 15px;
- display: block;
- font-family: arial;
- font-size: 8pt;
- }
-
- .messg
- {
- position: absolute;
- top: 30px;
- left: 5px;
- display: block;
- font-family: arial;
- font-size: 9pt;
- font-weight: bold;
- text-align: center;
- }
- </style>
-
- <hta:application ID="oToast"
- APPLICATIONNAME="Toast"
- BORDER="none"
- CAPTION="no"
- ICON=""
- INNERBORDER="no"
- MAXIMIZEBUTTON="no"
- MINIMIZEBUTTON="no"
- SCROLL="no"
- SELECTION="no"
- SHOWINTASKBAR="no"
- SINGLEINSTANCE="no"
- SYSMENU="no"
- VERSION="1.0"
- WINDOWSTATE="normal"/>
-
- <!-- settings and resources -->
- <div id="settings" style="display:none">
- <p id="resPreMin"></p>
- <p id="resPostMin1"> minute and </p>
- <p id="resPostMin"> minutes and </p>
- <p id="resPostSec"> seconds until mandatory logoff. Be sure to save your work.</p>
- </div>
-
- </head>
-
- <body text="navy" onload="Main()">
- <div id="btnClose" class="close" onclick="Self.Close()"></div>
- <div id="divTitle" class="title">Logoff Warning</div>
- <table id="tabMessg" border="0" class="messg">
- <tr valign="middle"><td><div id="divMessage"></div></td></tr>
- </table>
- </body>
- </html>
-
-
-
-
-
-