views:

1899

answers:

4

Hi All,

I need to run a web application in IE so it at least looks similar to a stand-alone application. I also need to be able to run multiple instances of this web application at the same time in separate sessions.

To achieve this look I'd like to always launch Internet Explorer 7 in a new process without toolbars/statusbar from a shortcut on the desktop.

I've tried a few things. So far the closet I've come to it is creating a shortcut to the following vb script,

Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Navigate "http://stackoverflow.com"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 1024
objExplorer.Height = 768
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1

This looks exactly like I want it to. However, if you double-click the shortcut again it does open a new window but within the same process (i.e. there is only one iexplore.exe process in the Windows Task Manager). Since the two instance are within the same process they're sharing the same session. So if you're logged in to one instance of the application then you're logged in to the other instance of the application, which is no good for me.

I also tried,

"Program Files\Internet Explorer\iexplore.exe" http://stackoverflow.com

which always launches a new process but you can't remove just the toolbars/statusbar. Kiosk mode (the "-k" parameter) is no good to me as I need it to appear in a window.

Can anyone tell how to always launch Internet Explorer 7 in a new process without toolbars/statusbar from a shortcut on the desktop?

I'm open to any kind of technology for the solution.

Thanks, Everett

+1  A: 

You can use a HTML Application like:

<html>
<head>
<title>Stack Overflow</title>
<hta:application showintaskbar="yes" singleinstance="no" sysmenu="yes" scroll="no"
icon="http://www.stackoverflow.com/favicon.ico"&gt;
<style type="text/css">
* { margin: 0px; padding: 0px; }
iframe { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; }
</style>
</head>
<body>
<IFRAME SRC="http://www.stackoverflow.com/" APPLICATION="no">
</body>
</html>

However, this tends to mess up the JS of whatever page is in there without special precautions for HTA.

MiffTheFox
Thanks for the suggestion but when I tried this I had problems with the JavaScript on my page (most of which I can't even touch).
Everett Toews
A: 

You can do this by manipulating the IE COM server. It's easy to do in powershell:

$ie = new-object -COM InternetExplorer.Application
$ie.ToolBar = $false
$ie.StatusBar = $false
$ie.Navigate2( "http://www.stackoverflow.com" )
$ie.Visible = $true

If that was in ie-app.ps1, then your shortcut would have "powershell -command ie-app.ps1" to invoke it.

This is essentially the same thing that you did with Windows Scripting Host in vbscript. You can use anything that can manipulate the InternetExplorer.Application COM object. I have IE8 and it may be just the difference between IE7 amd IE8 but with my powershell example, I get two processes.

Brian Reiter
Thanks for the suggestion but when I try this with Windows XP and IE7 I still only get 1 process.
Everett Toews
+1  A: 

You don't specify what coding regime you wish to use to accomplish this, but you will undoubtedly want to look into the WebBrowser Class.

Ishmael
I didn't specify the technology because I'm open to any solution (edited post).
Everett Toews
+1  A: 

None of the other answers worked out for me so here is a vb script I cobbled together from various sources (I'm not a vb scripter).

On Error Resume Next

AppURL = "http://www.stackoverflow.com"
AppToRun = "iexplore about:blank"
AboutBlankTitle = "Blank Page"
LoadingMessage = "Loading stackoverflow..."
ErrorMessage = "An error occurred while loading stackoverflow.  Please close the Internet Explorer with Blank Page and try again.  If the problem continues please contact IT."
EmptyTitle = ""

'Launch Internet Explorer in a separate process as a minimized window so we don't see the toolbars disappearing
dim WshShell
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run AppToRun, 6

dim objShell
dim objShellWindows

set objShell = CreateObject("Shell.Application")
set objShellWindows = objShell.Windows

dim ieStarted
ieStarted = false

dim ieError
ieError = false

dim seconds
seconds = 0

while (not ieStarted) and (not ieError) and (seconds < 30)

    if (not objShellWindows is nothing) then
     dim objIE
     dim IE

     'For each IE object
     for each objIE in objShellWindows

      if (not objIE is nothing) then

       if isObject(objIE.Document) then
        set IE = objIE.Document

        'For each IE object that isn't an activex control
        if VarType(IE) = 8 then

         if IE.title = EmptyTitle then
          if Err.Number = 0 then
           IE.Write LoadingMessage

           objIE.ToolBar = 0
           objIE.StatusBar = 1
           objIE.Navigate2 AppURL

           ieStarted = true
          else
           'To see the full error comment out On Error Resume Next on line 1
           MsgBox ErrorMessage
           Err.Clear

           ieError = true

           Exit For
          end if
         end if
        end if
       end if
      end if

      set IE = nothing
      set objIE = nothing
     Next
    end if

    WScript.sleep 1000
    seconds = seconds + 1
wend

set objShellWindows = nothing
set objShell = nothing

'Activate the IE window and restore it
success = WshShell.AppActivate(AboutBlankTitle)

if success then 
    WshShell.sendkeys "% r"  'restore 
end if

I'm open to any improvements or suggestions.

Everett Toews