Jump to content

How to prevent IE from getting the focus?


Recommended Posts

Suppose you create an IE using the special function _IECreate2 found here :

It has to be done this way because I need to take advantage of the command line parameters.

Now as you can see, IE is an entirely autonomous window -- that is, the embedding is faked.

That means, for example, that you can press Alt+F4 inside the "embedded" IE ... and it will close it without closing your AutoIt window!

Now how can I make sure that the focus doesn't go on IE?

For example, how can I intercept the focus being given to IE and add an event that would immediately pass it forward to someone else?

Any clever solution is accepted, even if you think out of the box.

the goal is simply to prevent wise guys from pressing key combinations on my "embedded" IE.

Edited by MonsieurOUXX
Link to post
Share on other sites

Suppose you create an IE using the special function _IECreate2 found here :

It has to be done this way because I need to take advantage of the command line parameters.

Now as you can see, IE is an entirely autonomous window -- that is, the embedding is faked.

That means, for example, that you can press Alt+F4 inside the "embedded" IE ... and it will close it without closing your AutoIt window!

Now how can I make sure that the focus doesn't go on IE?

For example, how can I intercept the focus being given to IE and add an event that would immediately pass it forward to someone else?

Any clever solution is accepted, even if you think out of the box.

the goal is simply to prevent wise guys from pressing key combinations on my "embedded" IE.

Capture the key strokes with "HotKeySet" (If thats what its called)?

I remember people saying that hotkey thing prevents it from passing through and let's you decide what to do with it.

Link to post
Share on other sites

$hwnd_ie = WinGetHandle("Some IE Window")
$hwnd_other = WinGetHandle("Some Other Window")
 
While 1
   Sleep(10)
   If WinActive($hwnd_ie) Then
       WinActivate($hwnd_other)
   EndIf
Wend

Edit:

*gets wise*

$hwnd_ie = WinGetHandle("Some Embedded IE Window")
ProcessClose(WinGetProcess($hwnd_ie))
Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...