Sign in to follow this  
Followers 0
ivan

Disable embedded IE context menu

4 posts in this topic

#1 ·  Posted (edited)

Run out of ideas :D

I've been trying to no avail to disable the context menu functionality of an embedded Internet Explorer at the start of a script and return the functionality back to normal before exiting the script.

As far as my brain can handle at the mo, the Context menu can be called via secondary mouse clicks or through the menu keyboard button. I don't ven know what it's called.

The only half decent idea I've got worth mentioning was as follows:

1) change my entire script to GUISetOnEvent mode

2) if the secondary mouse button was clicked, repeatedly send an escape keystroke controled by a timer.

That still leaves out the possibility of pressing the menu button on the keyboard, which I'm not that concerned about.

The other attempt I made was a straight no no. I tried replacing the browser's context menu by anything else, such as

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()

;; bla bla create the gui

$GUIActiveX = GUICtrlCreateObj($oIE, 25, 250, 550, 150)

$buttoncontext = GUICtrlCreateContextMenu($GUIActiveX)

$buttonitem = GUICtrlCreateMenuitem("About button", $buttoncontext)

As I expected, that didn't work.

Any better thought would be greatly appreciated.

THANKS

IVAN

Edited by ivan

Share this post


Link to post
Share on other sites



I think I was on the wrong track altogether. Forgive me for answering my own question, but leaving this thread as is might provide clues to others.

The solution is a lot simpler.

Modify the the body tag of the document inserting oncontextmenu="return false"

that's all there is to it.

1) Read the hypertext with _IEBodyReadHTML(ByRef $o_object)

2) modify the body tab adding oncontextmenu="return false"

3) Rewrite the body tag with _IEBodyWriteHTML(ByRef $o_object, $s_html)

IVAN

Share this post


Link to post
Share on other sites

I think I was on the wrong track altogether. Forgive me for answering my own question, but leaving this thread as is might provide clues to others.

The solution is a lot simpler.

Modify the the body tag of the document inserting oncontextmenu="return false"

that's all there is to it.

1) Read the hypertext with _IEBodyReadHTML(ByRef $o_object)

2) modify the body tab adding oncontextmenu="return false"

3) Rewrite the body tag with _IEBodyWriteHTML(ByRef $o_object, $s_html)

IVAN

Or, look at the examle for the function _IEHeadInsertEventScript that does exactly what you want :D

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

Share this post


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
Sign in to follow this  
Followers 0