|
-
Dec 19th, 2005, 10:16 AM
#1
Thread Starter
Addicted Member
[RESOLVED] block popups, disabe scrollbars, no right click in webbrowser component
Who know how to block popups from webbrowser component or to disable the scrollbar? or else no right click on the webbrowser component.
-
Dec 19th, 2005, 10:22 AM
#2
Re: block popups, disabe scrollbars, no right click in webbrowser component
This might help for the popup thing.
-
Dec 19th, 2005, 11:30 AM
#3
Thread Starter
Addicted Member
Re: block popups, disabe scrollbars, no right click in webbrowser component
This code work for disable popup`s
Code:
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Cancel = True
End Sub
now i need something for disable the scrollbar of webbrowser. Any idea?
-
Dec 19th, 2005, 11:33 AM
#4
Re: block popups, disabe scrollbars, no right click in webbrowser component
 Originally Posted by RoYeti
This code work for disable popup`s
Code:
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Cancel = True
End Sub
now i need something for disable the scrollbar of webbrowser. Any idea?
Try this
VB Code:
Public Declare Function EnableScrollBar Lib "user32.dll" (ByVal hWnd As Long, _
ByVal wSBflags As Long, ByVal wArrows As Long) As Long
'SCROLLBAR CONSTS
Public Const SB_HORZ As Long = 0
Public Const SB_VERT As Long = 1
Public Const SB_CTL As Long = 2
Public Const SB_BOTH As Long = 3
Public Const ESB_DISABLE_BOTH = &H3
Public Const ESB_DISABLE_DOWN = &H2
Public Const ESB_DISABLE_LEFT = &H1
Public Const ESB_DISABLE_RIGHT = &H2
Public Const ESB_DISABLE_UP = &H1
Public Const ESB_ENABLE_BOTH = &H0
'Example usage for disabling:
Call EnableScrollBar(WebBrowser1.hWnd, SB_BOTH, ESB_DISABLE_BOTH)
'Example usage for enabling both:
Call EnableScrollBar(WebBrowser1.hWnd, SB_BOTH, ESB_ENABLE_BOTH)
-
Dec 19th, 2005, 11:43 AM
#5
Thread Starter
Addicted Member
Re: block popups, disabe scrollbars, no right click in webbrowser component
 Originally Posted by Hack
Try this
VB Code:
Public Declare Function EnableScrollBar Lib "user32.dll" (ByVal hWnd As Long, _
ByVal wSBflags As Long, ByVal wArrows As Long) As Long
'SCROLLBAR CONSTS
Public Const SB_HORZ As Long = 0
Public Const SB_VERT As Long = 1
Public Const SB_CTL As Long = 2
Public Const SB_BOTH As Long = 3
Public Const ESB_DISABLE_BOTH = &H3
Public Const ESB_DISABLE_DOWN = &H2
Public Const ESB_DISABLE_LEFT = &H1
Public Const ESB_DISABLE_RIGHT = &H2
Public Const ESB_DISABLE_UP = &H1
Public Const ESB_ENABLE_BOTH = &H0
'Example usage for disabling:
Call EnableScrollBar(WebBrowser1.hWnd, SB_BOTH, ESB_DISABLE_BOTH)
'Example usage for enabling both:
Call EnableScrollBar(WebBrowser1.hWnd, SB_BOTH, ESB_ENABLE_BOTH)
I`m a new one please help me more. I paste this code in form code but it give me some errors..
-
Dec 19th, 2005, 11:47 AM
#6
Re: block popups, disabe scrollbars, no right click in webbrowser component
 Originally Posted by RoYeti
I`m a new one please help me more. I paste this code in form code but it give me some errors..
What errors did it give and on what lines did the errors occur?
-
Dec 19th, 2005, 11:52 AM
#7
Thread Starter
Addicted Member
Re:block popups, disabe scrollbars, no right click in webbrowser component
Compile errors:
Only comments may appear after End Sub, End function, or End proprerty
-
Dec 19th, 2005, 12:08 PM
#8
Re: block popups, disabe scrollbars, no right click in webbrowser component
 Originally Posted by RoYeti
Compile errors:
Only comments may appear after End Sub, End function, or End proprerty
This tells me that you have pasted the code in the wrong place on the form.
The API declare should be in the Form's declaration section along with the constants declarations.
The calls should be placed in an event, such as a Form_Load event or a button's click event.
-
Dec 19th, 2005, 12:17 PM
#9
Thread Starter
Addicted Member
Re: block popups, disabe scrollbars, no right click in webbrowser component
i put in the Form_Load but say`s the same thing and select me the first 2 lines
Code:
Public Declare Function EnableScrollBar Lib "user32.dll" (ByVal hWnd As Long, _
ByVal wSBflags As Long, ByVal wArrows As Long) As Long
-
Dec 19th, 2005, 12:19 PM
#10
Re: block popups, disabe scrollbars, no right click in webbrowser component
 Originally Posted by RoYeti
i put in the Form_Load but say`s the same thing and select me the first 2 lines
Code:
Public Declare Function EnableScrollBar Lib "user32.dll" (ByVal hWnd As Long, _
ByVal wSBflags As Long, ByVal wArrows As Long) As Long
You don't put this in the Form_Load. This goes in the Form's declaration section.
Open a code window. In the upper left hand corner will be a drop down box. Drop that down and locate "General" Click on General.
This will take you to the declarations section. Put that code there.
-
Dec 19th, 2005, 12:27 PM
#11
Re: [RESOLVED] block popups, disabe scrollbars, no right click in webbrowser component
The hWnd property of WebBrowser control may generate runtime error.
This page has an alternative function to get Webbrowser's hWnd.
By the way, Hack, your code is not working for Webbrowser control (WinXP-SP2, VB6-SP6). As far as I can remember, somewhere in the web I read that, the scrollbar of webbrowser control is a 'html thing'. It may not be removed this way.
-
Dec 19th, 2005, 12:29 PM
#12
Re: [RESOLVED] block popups, disabe scrollbars, no right click in webbrowser component
 Originally Posted by iPrank
By the way, Hack, your code is not working for Webbrowser control (WinXP-SP2, VB6-SP6). As far as I can remember, somewhere in the web I read that, the scrollbar of webbrowser control is a 'html thing'. It may not be removed this way.
Ok...I've never had the need nor desire to use the webbrowser control, so I just posted code that I've used on scrollbars of other controls. If my code doesn't work, then how would the member accomplish his goal?
-
Dec 19th, 2005, 12:49 PM
#13
Re: [RESOLVED] block popups, disabe scrollbars, no right click in webbrowser component
 Originally Posted by Hack
Ok...I've never had the need nor desire to use the webbrowser control, so I just posted code that I've used on scrollbars of other controls. If my code doesn't work, then how would the member accomplish his goal?
Sorry Hack. I didn't meant to sound rude. 
I was looking for this solution a few months ago. All pages I found in Google says that it can be done by only changing HTML code. Like, this one or this one
But they are not very useful if we want to show a webpage, instead of a picture.
This code by Francesco Balena uses GetSystemMetrics to get the size of the scrollbars and hide them behind a container picturebox.
We could use this idea or,
My idea is, when we get the height/width of scrollbars, just resizing the webbrowser may hide the scrollbars outside the form's client area. (instead of using a picturebox, we'll use the form. As it is already the contaier of webbrowser control)
I'm sorry again if I sounded rude. 
Edit: None of them are the 'perfect' solution. I'll be greatful if someone can give a more acceptable solution. I'm still searching for the solution.
Last edited by iPrank; Dec 19th, 2005 at 12:57 PM.
-
Dec 19th, 2005, 12:57 PM
#14
Re: [RESOLVED] block popups, disabe scrollbars, no right click in webbrowser component
 Originally Posted by iPrank
I'm sorry again if I sounded rude. 
You didn't at all. 
In fact, in re-reading my post, I think I may sounded a little rude, but that wasn't my intension either.
So, the bottom line of what you are telling me is that as far as you know, there are no real, clean, ways of disabling the webbrowser scrollbars? Right?
-
Dec 19th, 2005, 01:00 PM
#15
Re: [RESOLVED] block popups, disabe scrollbars, no right click in webbrowser component
 Originally Posted by Hack
So, the bottom line of what you are telling me is that as far as you know, there are no real, clean, ways of disabling the webbrowser scrollbars? Right?
Yes. That's what I found (or didn't found ) by searching.
-
Mar 23rd, 2010, 11:51 AM
#16
New Member
Re: [RESOLVED] block popups, disabe scrollbars, no right click in webbrowser componen
Dear Sir,
Today only i visited this forum and found it very useful.
I know programming in VB6, and currently facing a problem.
The problem is that i want to open the link on my webbrowser control in in a new window.
If i am using the right click > open in new window then i am able to catch it via..
Code:
Private Sub wb_NewWindow2(index As Integer, ppDisp As Object, Cancel As Boolean)
........
.........
frmMain.wb(new_index).RegisterAsBrowser = True
Set ppDisp = frmMain.wb(new_index).Object
End Sub
But what i want is even if somebody click the left mouse button on a link, i shall be able to open it in a new window (with session maintained).
Second thing is that i want to scroll the loaded page programatically (pagedown/pageup).
Is it possible to do the above two actions?
Last edited by limpu.cool; Mar 23rd, 2010 at 11:59 AM.
-
Apr 30th, 2013, 08:41 AM
#17
New Member
Re: [RESOLVED] block popups, disabe scrollbars, no right click in webbrowser componen
WebBrowser1.Document.body.setattribute "scroll", "no"
try this
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|