Jump to content

Controlling IE windows


JamesNL
 Share

Recommended Posts

Hi,

I'm developing a web application that is hosted from within a HyperText Application (the file is called client.hta, it runs fullscreen on some kind of voting machines). From within this HTA, I open a website via an Iframe. I have used AutoIt before to block starting programs like the task manager or Internet Explorer.

But, now I want to add advertisements to the website, I also want to have them open in a new window, so I need to allow iexplore.exe to open. Unfortunately, there is no easy way to entirely control IE.

I've written this script, it almost works as I want it it:

HotKeySet("^o", "DoNothing")
HotKeySet("^O", "DoNothing")

HotKeySet("^p", "DoNothing")
HotKeySet("^P", "DoNothing")

HotKeySet("^n", "DoNothing")
HotKeySet("^N", "DoNothing")

HotKeySet("{F1}", "DoNothing")
HotKeySet("{F2}", "DoNothing")
HotKeySet("{F3}", "DoNothing")
HotKeySet("{F4}", "DoNothing")
HotKeySet("{F5}", "DoNothing")
HotKeySet("{F6}", "DoNothing")
HotKeySet("{F7}", "DoNothing")
HotKeySet("{F8}", "DoNothing")
HotKeySet("{F9}", "DoNothing")
HotKeySet("{F10}", "DoNothing")
HotKeySet("{F12}", "DoNothing")
HotKeySet("{F12}", "DoNothing")

HotKeySet("^e", "DoNothing")
HotKeySet("^E", "DoNothing")

HotKeySet("^i", "DoNothing")
HotKeySet("^I", "DoNothing")

HotKeySet("^h", "DoNothing")
HotKeySet("^H", "DoNothing")

HotKeySet("^b", "DoNothing")
HotKeySet("^B", "DoNothing")

HotKeySet("^f", "DoNothing")
HotKeySet("^F", "DoNothing")

HotKeySet("{ESC}", "DoNothing")

HotKeySet("!b", "DoNothing")
HotKeySet("!B", "DoNothing")

HotKeySet("!w", "DoNothing")
HotKeySet("!W", "DoNothing")

HotKeySet("!l", "DoNothing")
HotKeySet("!L", "DoNothing")

HotKeySet("!f", "DoNothing")
HotKeySet("!F", "DoNothing")

HotKeySet("!x", "DoNothing")
HotKeySet("!X", "DoNothing")

HotKeySet("!h", "DoNothing")
HotKeySet("!H", "DoNothing")

HotKeySet("!{home}", "DoNothing")
HotKeySet("!", "DoNothing")


AutoItSetOption("WinTitleMatchMode", 2)

While ProcessExists("iexplore.exe")
    If ControlHide("Internet Explorer", "", "ReBarWindow321") = 0 Then
        MsgBox(16, "Fout", "Unable to secure IE. Killing IE.")
        ProcessClose("iexplore.exe")
    EndIf
    Sleep(1)
WEnd

Func DoNothing()
EndFunc

As you can see, I use a lot of HotKeySet()'s to block the hotkeys in IE. I use ControlHide to completely hide the IE toolbar (menu bar, toolbar and addressbar). This works very well (it creates a grey place on where the toolstrips used to be, ah well, too bad), but pressing the ALT-key and then pressing the down key still opens a menu, and gives the user access to the 'new window' and 'open' options.

Is there any way I can prevent this, or completely hide that toolbar like most internet café software does?

Thanks in advance!

P.S. I am using a Dutch IE6, so some hotkeys might be different from the English ones.

Link to comment
Share on other sites

_IEAttach with the "ebmedded" parameter will allow you to attach to a .hta

You can then use several of the _IEPropertySet commands to turn off specific controls. You might also want to look at theatre mode.

I am not familiar with Alt-Down -- can you explain more about that?

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Thanks DaleHohm, but it is not exactly what I meant.

When I click an ad from inside the .hta, it opens a new Internet Explorer window (a regular IExplore.exe), I want to modify that window.

What I meant with alt-down was this:

Open a new IE window. Press ALT. Press the Down arrow. I want to prevent that from happening.

Link to comment
Share on other sites

Thanks DaleHohm, but it is not exactly what I meant.

When I click an ad from inside the .hta, it opens a new Internet Explorer window (a regular IExplore.exe), I want to modify that window.

What I meant with alt-down was this:

Open a new IE window. Press ALT. Press the Down arrow. I want to prevent that from happening.

You can watch for new windows with WinActive (e.g. with AdLib).

I see that the Alt press/release followed by a Down arrow key activates the window menu... I'm sure there is a way to intercept that but I don't know it off hand.

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...