cancel
Showing results for 
Search instead for 
Did you mean: 

How to Format a Custom Internet Explorer window?

henderson1977
Grafter
Posts: 191
Registered: ‎31-07-2007

How to Format a Custom Internet Explorer window?

Hi all
We launch a formatted Internet Explorer window to display progress to our users during lengthy installations.  We use 2 files in total:-
1) Animated gif 'progress bar' to simulate a real progress bar.
2) A VBScript that create a custom Internet Explorer window, complete with text and animated gif 'progress bar' to provide on-screen feedback to users:-
----------------------------
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
  intHorizontal = objItem.ScreenWidth
  intVertical = objItem.ScreenHeight
Next
Set objExplorer = CreateObject _
  ("InternetExplorer.Application")
objExplorer.Navigate "about:blank" 
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Left = (intHorizontal - 350) / 2
objExplorer.Top = (intVertical - 200) / 2
objExplorer.Width = 403
objExplorer.Height = 310
objExplorer.Visible = 1
objExplorer.document.ParentWindow.document.body.style.backgroundcolor = "White"
objExplorer.document.ParentWindow.document.body.scroll="no"
objExplorer.document.ParentWindow.document.body.style.Font = "10pt 'Arial'"
objExplorer.document.ParentWindow.document.body.style.borderStyle = "outset"
objExplorer.document.ParentWindow.document.body.style.borderWidth = "4px"
objExplorer.Document.Body.Style.Cursor = "wait"
objExplorer.Document.Title = "Installing XXXX"
objExplorer.Document.Body.InnerHTML = "Installing XXXX. <P><B>PLEASE DO NOT OPEN ANY APPLICATIONS UNTIL THE INSTALLATION HAS COMPLETED AND THIS WINDOW HAS DISAPPEARED.</B><P>" _
  & "<img src='\\server\share\XXXX\progress.gif' WIDTH=345><P><B>Please wait...</B><P> "
----------------------------
We just need to amend the VBScript according to the affected application then call it in a batch file.  There is a sample script on Scripting Guy website that talks through how to create a 'real' progress bar if preferred but a 'simulated' progress bar is good enough for our purposes.
I've been meaning to disable the Mininise/Maximise/Exit buttons from the Internet Explorer window to prevent users prematurely closing the window, but as yet have not found a way to do so.  You will see what I mean from the attached screenshot.  I think we need to play with the "objExplorer." variable but not sure quite how.  Answers on a postcard....
Thanks
Scott
2 REPLIES 2
samuria
Grafter
Posts: 1,581
Thanks: 3
Registered: ‎13-04-2007

Re: How to Format a Custom Internet Explorer window?

have you considered Auto3 free from
http://www.autoitscript.com/autoit3/
Its dead easy to write scripts and it produces a exe file. One line of code can do what it takes 10 lines to do in VB not only that you can do a progress bar which is built in. If you get the full package there is a designer like vb so you can design the screen and it will produce the code for you.
You will never go back to vb if you try it
henderson1977
Grafter
Posts: 191
Registered: ‎31-07-2007

Re: How to Format a Custom Internet Explorer window?

Thanks samuria, will give it a go.
Scott