• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 565
  • Last Modified:

Stop WebBrowser MessageBoxes

Hi,

Does anyone know how to stop the "Do you want to allow.."  MessageBoxes appearing whenever you use 'cut', 'copy' & paste with the WebBrowser control?

For example, I'm allowing the user to paste content from the Clipboard directly into the control, though when you click the menu option, you get an annoying "Do you want to allow this page to paste information from your clipboard?" message.

I'm using the following code:

   webBrowser1.ExecWB OLECMDID_PASTE, OLECMDEXECOPT_DONTPROMPTUSER

Can this message be suppressed, as I can't seem to find a property to achieve this?
0
amtate
Asked:
amtate
  • 5
  • 3
1 Solution
 
edwardiiiCommented:
Howdy.

I'm able to paste images and/or text by putting your code into a command button's click event.  Are you referring to the menu accessed by right-clicking on the WebBrowser document?
0
 
edwardiiiCommented:
I'm not sure what prompts the error you're getting.  Possibly "WebBrowser1.Silent" and/or On Error Resume Next will help.  If not, allowing users to complete a paste operation as I detailed above may be a workaround.
0
 
amtateAuthor Commented:
Hi,

This is being done from within a click event - in this case from a ToolBar button...

If I set WebBrowser.Silent = True - it does stop the messages, though unfortunately it also stops the paste event from happening!

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
edwardiiiCommented:
Is putting the paste event in a comment button an option?
0
 
amtateAuthor Commented:
not sure what you mean here?
0
 
amtateAuthor Commented:
Incidentally, If I use the right-click context menu to cut; copy paste etc - I don't get any prompt messages...
0
 
edwardiiiCommented:
My last comment was a suggestion to place a separate command button near your WebBrowser control and place the following code in it:

     webBrowser1.ExecWB OLECMDID_PASTE, OLECMDEXECOPT_DONTPROMPTUSER

When I test this it does what you're trying to do without any pop-up.  If I'm understanding you correctly, you've created a menu and posititioned it above your WebBrowser control.  When you try to paste into the WebBrowser control by clicking one of the menu options, you're getting the pop-up message "webBrowser1.ExecWB OLECMDID_PASTE, OLECMDEXECOPT_DONTPROMPTUSER", is that right?  When I went to the top menu and Tools/Menu Editor and added a "Paste" button, then added the code above into it, it worked fine w/o any pop-up.

Can you clarify what you're clicking when you get the popup (e.g. menu item of menu you created, something other, etc.).
0
 
edwardiiiCommented:
Sorry--please replace the quoted expression from:

    When you try to paste into the WebBrowser control by clicking one of the menu options, you're getting the pop-up message "webBrowser1.ExecWB OLECMDID_PASTE, OLECMDEXECOPT_DONTPROMPTUSER", is that right?

with

"Do you want to allow.."  
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now