Supress pop-up with VB 2008 Express Edition - vb.net

The radio recently broke in our bedroom and as a result my missus now listen to various radio stations through her laptop. She moans that visiting various pages and clicking the 'listen' link is a bit of a pain. (Note to self: Must buy new radio!)
In the meantime, I have made a 'radio player' in VB 2008 Express, which is nothing more than 6 buttons down the left hand side of the 'player' I have created and a Web Browser Control on the right hand side.
Clicking each button links to the relevant player of the station she wants to listen to. (Being a newbie to VB and programming, I'm quite proud with what I've achieved so far!!)
Anyway, one station I do link to gives an "Are you sure you want to navigate away from this page" prompt: This one:
http://www.mygoldmusic.co.uk/
Well, thats the homepage of the site anyway, the actual player is here:
(Oops, seems I can only post one link! The actual player opens on-click of the 'listen' button then, sorry to be a pain!)
My question is: Is there a way to suppress this message in VB, or even auto-answer OK somehow?
The other sites I have linked to do not display this message, they just navigate away quite happily. Clicking OK on the prompt is no real hardship either, I hear you say, but in the interests of usability, I would just like it to navigate away from the site/player without prompting.
Remember, I'm using Microsoft Visual Basic 2008 Express Edition. (I say that, because I've come across loads of sites that tell you how to do it with JavaScript, just not VB!)
I've got to the point of thinking it can't be done, but here's hoping!
Any help/advice would be greatly appreciated. And, sorry for the lengthy question. Hope it gives you enough info on what I'm trying to achieve.
Thanks in advance again.
J.

The only way I can think of is to actually modify the DOM of the page in the WebBrowser control. That popup is loading when the "window.onunload" event fires. You should be able to override this behaviour by modifying the DOM.
The HTML document DOM (Document Object Model, essentially an object graph of the page structure) is stored in the WebBrowser.HTMLDocument property. Unfortunately, that specific property isn't available to the .NET version. It IS available to COM however, so through some very ugly and messy code you might be able to suppress the event.
The following code should be able to access the COM property containing the HTML DOM. The type returned is IHTMLDocument2, although you'll note that the class itself will return an object. You might need to add a reference to mshtml.dll to get the IHTMLDocument2 interface access the properties of this in a reasonable way.
Dim domDocument As IHTMLDocument2 = webBrowser.HtmlDocument.DomDocument
You can then access the OnUnload event (which sits on the "window" element, one above the document). Unfortunately, the plot thickens a bit here (I did say it was going to be ugly) because you need to pass a IDispatch object to the onunload event. I've never done this specifically but I found a write-up at the following link that provides some samples and should point you in the right direction: http://blogs.msdn.com/cgarcia/archive/2009/08/28/handling-dom-events-in-a-c-activex.aspx
You should be able to follow a similar approach but simply do nothing in the handler method, which should suppress the javascript alert you are getting.

Get the handle to the dialog and destroy it. Use FindWindow and send a WM_CLOSE message to it.

Related

How to generate Domino dialogboxes on traditional (non-xpages) webforms

I want to have a popup/dialogbox with an "OK" button on it that will close the dialogbox...after someone performs a task on a Domino webform. I know I used overlays in xpages before, but the current application I am maintaining was built with traditional Domino forms (lots of pass-thru HTML) and my initial attempt to build an overlay effect did not work.
I have tried using javascript code of:
var window = window.open(url, windowName, [windowFeatures]);
...but this has not been successful. No errors in debug, yet my url page does not pop up. I am hoping someone might be able to provide a snippet of what you use so I can see where I am going wrong.
The url parameter I am passing is correct, as I used an alert to show me what was going in there, but I am doing something basic wrong.
If I can answer any questions for you I can do that as well.
Thank you
The only way I know to display a dialog box in a classic Domino web application is to do just like you would on any HTML-based webpage. Either you create your own popup functionality, or you use one of the many plugins available.
When I work with classic Domino web applications, I have often added Bootstrap to it, to make things look a bit better. Then I can use either the native Bootstrap dialog boxes, or a plug-in called Bootbox.js. But there are many other ones.

How to develop inspect element tab for my Web Browser(Using VS2015 Community) in VB.NET

How to Develop inspect element tab section for my Web Browser which i've developed in VS2015 Community. Please help I'm searching this from last few days...
A suggestion for this could be using the TreeView Class which could potentially provide you with what you are looking for (If you're looking to create the 'Inspect Element' in it's entirety). If you just want the code then simply using the DocumentText WebBrowser Property would do that. Just having a TextBox and writing the document text into it, then you could make changes and then on a 'onFocus' Event on the WebBrowser you could have it write the edited text back to the browsers html code.
(I have done the second way before out of curiosity and it's obviously much simpler than the other way that i have suggested)
-
But with the TreeView :
You can dynamically add Nodes to that object.
Roots are 'Base' Nodes (Parents) and the and the Child, well, is obviously the Child of the Root Node.
(A node consisting of an actual name to call it by, a display name (text), and a tag for any extra info.)
But anyways, the TreeView would be the most work to do.
A few other things potentially worth your time to look at, if you chose to do either option, I've written below in a comment.

Tab Order in Visual Studio hates me

Tab Order in Visual Studio does not work for me for some reason.
I am making a VB.NET plugin for a cad program called Rhinocreos 5.
I have everything set perfect, and I don't know what the cause of it is.
I am using .Show() instead of .ShowDialog(), because I need that thread open and I don't feel like doing any thread management (not paid enough lol)
Does anyone have any pointers for this? Has anyone else ran into a tab problem with Rhino5 and .NET?
EDIT**
Seems I have to use a MODELESS Form for a rhino plugin.... So I wont have any tab keys or arrow keys unless I do a hook. But since I need to make the plugin future proof (in case I am no longer working here), I won't be doing that either. But thanks for the answers, comments, and awesome downvotes.
Very difficult to guess what's going on from the information you have provided, but I'd check the following things in the following order:
The disobedient form is open and has focus.
The form has controls in it.
At least some of the controls are enabled, focusable have their TabStop set to true.
There is no low-level keyboard handling in action (PreviewKeyDown, hooks etc).
Finally I'd call ShowDialog() instead of Show(), passing main form as parameter (to make disobedient form a child of main form) and see if that makes a difference.
It was a modeless form inside of Rhino3D as a plugin.
Rhino3D uses all plugins in the main thread. So tab is not an option.
The workaround was to tag all controls with a tag work (I used "tabMe")
Then I store all the controls in a List myTabbyControls.
Each time I press tab, I would cycle through the list.
But thanks for the down votes. It's the running joke of SO.

disable mouse click for a while, of filter mouse clicks

Im using Visual Basic 2008 Express
Is there a way to disable mouse click for a while in Visual Basic 2008, I mean if mouse was clicked more than 1 time in very short time to click only once? -- I need it because my mouse became like crazy one.. when I click once it may clicks twice or more.., This is very very annoying... so until I buy another one, I'd like to filter click, to allow only one click and to block another clicks that were made in last second.
P.S : sorry about that question, but it is really annoying...
Thanks :)
There's an article on processing global mouse events on The Code Project: Processing Global Mouse and Keyboard Hooks in C#. It looks like the article lead to a project called Global Mouse and Keyboard Hooks .NET Libary in C#. You should be able to include the library in your VB.NET project and attach to events from there. The article also references some other information on MSDN that you should read before embarking on this project.
This is something that would be much easier to do from an unmanaged language like C or C++ though.
Although these samples are in C#, they should be easy enough to translate into VB.NET.

Windows Phone 7 WebBrowser control swallows manipulation events?

If I place a WebBrowser control on any page, the page no longer responds to manipulation events under the WebBrowser. Other areas of the page work fine.
It's easily confirmed by overriding OnManipulationCompleted in a page, then placing a WebBrowser control on the page. Try swiping over the WebBrowser, and OnManipulationCompleted is never called.
I can't set the WebBrowser to IsHitTestVisible=false because I need to be able to click on links. But I want the page to respond to left/right swipes.
Anyone got any bright ideas? Or know if this is a bug in the current release?
I'd like to extend what Skeet already written.
The point is, that the MS WP7 dev team has published "guidelines", where they highly discourage putting (on the same page) multiple layout controls that accept and react to the same set of gestures. For example, you shouldn't try to embed a Pivot inside a Pano, because the horizontal-swipe will clash and it will be hard do distinguish which of them should execute its actions. The same case is with the browser: it responds to all swipes and pans.. so should not be put in almost any scrolling control!!
Now, having said that, I want to tell you it is possible to overcame it - although it may turn not easy, depending on your actual case.
The most trivial thing to do, if you want to still be notified about the gestures is to use GestureService/GestureListener from the Silverlight Toolkit library. Even when the WebBrowser extinguishes the raw manipulations events, the GestureListener will still be able to notify you - because it apparently listens on some "other layer", I don't exactly want to get in to it now. Just fetch the library, add-reference it, do something like:
GestureService.GetListener( targetcontrol ).Flick( myBrowserFlickHandler );
and it's done - you get the notification whenever someone flicks on the control, with completely no regard of the manipulation events being e.handled=true or not. Small disclaimer here: I don't remember if on 7.0 it works, because the WebBrowser is build a bit differenlty there. On 7.1 and 7.5 it should work.
However, if you apply that on a WebBrowser - you will get the notif - but the webbrowser will get it too. That means, that 2 controls will react, and it turn to be visually quite rejecting if you start some storyboards from within the handler..
On 7.1 and almost-current 7.5, it is possible to play hard with the WebBrowser and to completely control which manipulation-event it will see. Thus, by filtering the mani-events for the WB, and by using GestureListener to see the events yourself, you can both block the WB from doing anything, and at the same time you can respond with your own action instead. I've written about that extensively in a response to similar problem, see WP7 Pivot control and a WebBrowser control for details. It is not a quick/easy/funny thing to do though.
EDIT: and MOST importantly, it is NOT guaranteed to work in the future. Throughout the 7.1 and 7.5 SDK/OS/API versions, inside the WebBrowser control some major internal undergoing changes are visible, and I would not be surprised, if it would dramatically change in the next few releases. Don't play with the things I've wrote there about if you do not want to have to revisit the subject again in the next 1-2 years.
This is a consequence of the way we implemented WebBrowser. The touch events are handed off directly to the browser engine. Once that happens Silverlight is basically out of the picture. Unfortunately I can't think of any workarounds that might give you what you want. -Skeets, MS dev
If you really want it:
<Grid>
<phone:WebBrowser Source="http://www.microsoft.com" />
<Rectangle Fill="Transparent" ManipulationCompleted="HandleManipulationCompleted"/>
</Grid>
But of course it completely locks down interaction with web browser control and there's just no way to echo manipulation events to browser...
I think you have a better way capturing the manipulation events, if it is in WP7.5 Mango since the browser controls are completely different, which I read from this link