Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to minimize window?

How to minimize window?

I am making HTA application and I want replace window title bar with my custom one. I've disabled it by HTA's "caption=no" option and placed my own minimize/maximize/close buttons.

I found two ways to minimize window:

  • Shortcut ALT + SPACE + n
  • Shortcut WinKey + ArrowDown

So I could send this shortcuts to window using WScript.Shell's SendKeys method.

WsShell = new ActiveXObject("WScript.Shell")
WsShell.SendKeys("% n")

But the first one can't be used because there is no title bar, and the second because WinKey doesn't work with SendKeys.

I found MinimizeAll() method of Shell.Application, but it's alone.

Is there any other way to minimize the window? May be another activeX object or shortcut?

like image 390
Levon Avatar asked Oct 15 '25 22:10

Levon


1 Answers

I came up with exact the same issue. This is the solution that worked for me:

Place in the <head> section:

<object id="HHCtrlMinimizeWindowObject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
    <param name="command" value="minimize" />
</object>

<script type="text/javascript">
function _jsMinWin( ) {
    try {
        HHCtrlMinimizeWindowObject.Click( );
    }
    catch ( err ) {
        alert( err.message );
    }
}
</script>

Then on <body> section something like:

<input type="button" value="Minimize Window" name="MinimizeWindow" id="MinimizeWindow" onclick="javascript:_jsMinWin();" />
like image 140
F.Mysir Avatar answered Oct 19 '25 12:10

F.Mysir