In my software there's a WebBrowser control and I'd like the mosue buttons 4 and 5 to do back/forward like in other browsers. I added code to handle the clicks on the main form but it never gets triggered.
How would I add this feature?
Thanks
In my software there's a WebBrowser control and I'd like the mosue buttons 4 and 5 to do back/forward like in other browsers. I added code to handle the clicks on the main form but it never gets triggered.
How would I add this feature?
Thanks
What are you using to detect buttons 4 and 5?
I'm not using anything now, I don't know how to do this, I'd like to know how.
Thank you
What kind of a mouse has 5 buttons on it? My mouse has 4 buttons: Left button, Right button, Scrollbar button, and Previous/Current toggle button. What would button 5 do?
Last edited by jmsrickland; May 5th, 2012 at 12:38 PM.
The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved
When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day
That does add up to 5:
"Left button (1), Right button (2), Scrollbar button (3), and Previous (4)/Current (5) toggle button"
I assume you meant "Forward" and not "Current" as a button that brings you where you currently are wouldn't do anything lol.
The 4th and 5th buttons do previous/forward in every web browser I've used and I'd simply like these buttons to also do this in my program's browser.
Thanks
No, my mouse has 4 buttons. The 4th button clicked once puts you at the previous page and the next click
returns you back to the page you left on your 1st click.
The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved
When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day
Is it an old mouse? All the ones I saw in the last 10 years or so have 5 buttons.
My computer is old too, more than 10 years
Last edited by jmsrickland; May 6th, 2012 at 05:17 PM.
The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved
When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day
I don't know if this is going to be of any help and I kind of think it won't but you might try using
vKey = 1 for Left clickCode:Private Declare Function GetAsyncKeyState Lib "user32"(ByVal vKey As Long) As Integer
vKey = 2 for Right click
vKey = 4 for Scroll wheel
vKey = 5 for the Toggle button
The problem with using this API is that it will detect any key pressed anywhere and that means anywhere. You know that there are no mouse events for the WebBrowser control so you would have to set up a timer event that detects the key but here the problem is how to know if the key or mouse button was pressed over the browser window.
The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved
When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day
Somewhere there is a program that tells you where the mouse is at any time. Example; as you move the mouse around the Form and over controls a message at the top of the Form tells you that the mouse is over a textbox, or it is over command button, or listview, etc, etc. I don't know where this VB program is but I remember seeing it either here or some other programming forum. You need to find this program and get it's code for detecting the location of the mouse.
Let's say you are lucky and you have found it then you can do something like this
My mouse only has 4 buttons so I do not know the VKey for the 5th button
Also, here is a link I found that may be of some help:Code:' ' Private Declare Function GetAsyncKeyState Lib "user32" (ByVal VKey As Long) As Integer ' ' Private Sub WebBrowser1_MouseDown(Button As Integer) Select Case Button Case 1 Label1 = "Left Click" Case 2 Label1 = "Right Click" Case 4 Label1 = "Scroll Wheel" Case 5 Label1 = "Toggle Button" End Select End Sub Private Sub Timer1_Timer() Dim VKey As Integer Timer1.Enabled = False ' ' Put the code to determine where the mouse is here. If the code detects that the mouse is over ' the WebBrowser then set MouseOverWebbrowser = True ' If MouseOverWebbrowser Then For VKey = 1 To 5 If GetAsyncKeyState(VKey) Then WebBrowser1_MouseDown VKey Exit For End If Next VKey End If Timer1.Enabled = True End Sub ' '
http://www.vbaccelerator.com/home/VB...ks/article.asp
Last edited by jmsrickland; May 6th, 2012 at 08:37 PM.
The better the information you give to begin with and the sooner you reply the sooner you will get help and get your problem resolved
When I was young and in my prime I used to program all the time but now I'm old and getting gray I only program once a day