?
Solved

Restoring HTA after it has been minimized using the "show desktop" button

Posted on 2009-02-13
5
Medium Priority
?
1,729 Views
Last Modified: 2012-05-06
I have an HTA application of which I've locked down so the user cannot minimize, close, or modify the contents of the window.  It is simply a "HUD", if you will, that we want to always be showing on the user's machine.

The only way a user can minimize the application now is to click the Show Desktop button.  Is there a way I can restore the window from the minimized state or atleast read if it is minimized?
0
Comment
Question by:piattnd
  • 2
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
jwarnken earned 1000 total points
ID: 23650553
You will need to add a function to check the window state periodically.
see to get the state http://msdn.microsoft.com/en-us/library/ms536494(VS.85).aspx

You can then try using AppActivate to restore the window.
see http://msdn.microsoft.com/en-us/library/wzcddbek(VS.85).aspx
 
0
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 1000 total points
ID: 23653283
Hi, this HTA will detect when it has been minimised, but I'm yet to figure out how to maximise it reliably....

Regards,

Rob.
<html>
<title>Test HTA</title>
<hta:application 
     id = "objHTA"
     applicationname="Test HTA"
     scroll="yes"
     singleinstance="yes"
     windowstate="normal"
>
<script language="vbscript">
 
'----------------------------------------------------------------------------------------
     Sub Window_onLoad 
         iTimerID = window.setInterval("CheckState", 2000)
     End Sub
 
'----------------------------------------------------------------------------------------
     Sub CheckState
         Set objShell = CreateObject("WScript.Shell")
         If window.ScreenTop < 0 Then
         	MsgBox objHTA.ApplicationName & " has been minimized."
         End If
     End Sub
 
</script>
</head> 
<body>
	<h2>Test HTA</h2>
</body>
</html>

Open in new window

0
 
LVL 12

Author Comment

by:piattnd
ID: 23664251
Interesting enough, the program doesn't actually realize it's been minimized if you use the Show Desktop option.

Here's another interesting thing.  If a user minimizes the windows using the Show Desktop feature, upon clicking any of their windows, the HTA restores itself.

I'm hoping this action continues to perform as it is.  I'm going to post another question regarding a script to possibly replace the Show Desktop feature.  I'm interested in making a script that minimizes all other active apps other than the contract stats.
0
 
LVL 12

Author Closing Comment

by:piattnd
ID: 31546789
Thank you both for your assistance.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 23665285
Hi,

You can use this code to minimize all windows except the one with the specific title that you specify.

This requires that Microsoft Word is installed though.

Regards.

Rob.
strTitle = "Test HTA"
Const wdWindowStateNormal = 0
Const wdWindowStateMaximize = 1
Const wdWindowStateMinimize = 2
Set objWord = CreateObject("Word.Application")
'objWord.Visible = True
For Each objWindow In objWord.Tasks
	If objWindow.Visible = True Then
		If objWindow.Name <> strTitle Then objWindow.WindowState = wdWindowStateMinimize
	End If
Next
objWord.Quit

Open in new window

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question