Hello ebarker-ga,
There are two possibilities you are looking for here. One is that you
need to use the Windows API to programatically minimize the IE window,
and the other is that you are looking to use DHTML to minimize the
window.
I have researched both, and provided sources for how you can do this.
The first I researched was the DHTML / Javascript way of minimizing
the current IE window. I found quite a good 'how-to' on creating IE
toolbars at reference (1). I then had a look for how to minimize the
IE window. It appears that a lot of people are having trouble with
this, however a possible work-around was found at reference (2).
Basically, this involves putting the window 2000px off the screen, and
so to all intents and purposes the window is 'minimized' (I.e. off
screen). The script that does this looks like this:
<script language="javascript">
show=1
function minimize(){
moveBy(2000,2000)
show=0
}
function reshow(){
if(show==0){
moveBy(-2000,-2000)
show=1
}
}
</script>
I tested this out, and the author had made an error in the 'if'
statment, and failed to close their brackets. This is the edited,
tested and working script. I tested it in IE6 on Windows XP, however
it should work from IE4 upwards.
You will then need to put a onfocus=reshow() to the body tag. Also,
you would put into the button the code to call minimize(). This would
have the desired effect of moving the window off the screen. When
focus is passed back to the window, the code in the body tag means
that it is move back onto the screen.
---
The other option is to programatically minimize the window by calling
the Windows API. I am assuming you are using VB, since that is the
most common programming language for producing toolbars and the like.
After doing some research, the API call do monitor windows is
ShowWindow (Reference 3). This requires the window handle of the
current window. See reference 4 for information on how to do this.
Sample code (Please note, I have not tested this in a VB environment):
-------------------------
Private Declare Function M_GetActiveWindow Lib "user32" _
Alias "GetActiveWindow" () As Long
Function GetActiveWindow() As Long
Dim xHwnd As Long
xHwnd = M_GetActiveWindow()
GetActiveWindow = xHwnd
End Function
-- In button onClick() event --
dim myHwnd as Long ' return value
dim retVal as Long ' the return value from the ShowWindow function
myHwnd = GetActiveWindow() ' get the hwnd value of the active window
retVal = ShowWindow(myHwnd, SW_MINIMIZE) ' minimize the IE window.
---------------------------
I hope this helps you to minimize (or simulate minimizing) from
Internet Explorer. So you know what articles I got this information
from, I have included the Google Searches and the Articles I saw:
Google Search - Creating Internet Explorer Toolbars
(1) [ http://www.webreference.com/dhtml/column29/ ] - DHTML
Application Toolbars
Google Search - "Minimize IE" javascript
(2) [ http://lists.evolt.org/archive/Week-of-Mon-20020225/105265.html
] TheList at lists.evolt.org - Javascript Minimize.
Google Search - Minimize API VB
(3) [ http://216.26.161.91/vbapi/ref/s/showwindow.html ] -
ShowWindow() VB API call reference
Google Search - Get current window handle VB
(4) [ http://www.vbsquare.com/api/tip368.html ] - Get the current
active window handle (hwnd)
Extra information
-----------------
If you are using Delphi, There is a Delphi plugin, registration
US$10.55, that allows you to access the various controls in IE,
including minimize and maximize controls.
[ http://www.jazarsoft.com/ ] - Jazarsoft homepage
[ http://www.jazarsoft.com/vcl/view.php3?id=33 ] - IE Control
information page.
I hope this helps you,
LazerFX-GA |