|
-
May 17th, 2008, 10:07 AM
#1
Thread Starter
Hyperactive Member
Web Browser New Window
Is there any way i can make a link that usually opens in a new window open up in the current window?
Because when i press certain links in the web browser i made, it opens it up in Internet Explorer, which I blocked.
Or could i make a vb web browser my default web browser, so it will open up in a new browser, but still my browser?
Thanks,
Philly0494
-
May 17th, 2008, 11:43 AM
#2
Re: Web Browser New Window
This will open up a new window in your application but not in the same window that you would want it to. I have not been able to figure that one out.
Code:
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Dim frmWB As Form1
Set frmWB = New Form1
frmWB.WebBrowser1.RegisterAsBrowser = True
Set ppDisp = frmWB.WebBrowser1.Object
frmWB.Visible = True
End Sub
-
May 17th, 2008, 12:09 PM
#3
Lively Member
Re: Web Browser New Window
I created my own browser and the links work only in that browser.
Are you using the browser engine?
- browser engine 2.0 library.
If so then you should have a default browser window control named similar to brwWebBrowser.
and it uses CboAddress.Text -combo-box for addresss input.
I think with this browser window it is autmatic.
If you created a custom window without the browser engine It could create your problem.
.
-
May 17th, 2008, 12:28 PM
#4
Re: Web Browser New Window
Jabber,
I get the impression that what you made is better than using WebBrowser control. Do you have to literally make your own callback events?
Where do you get that library? I can't find it in my project references.
Last edited by jmsrickland; May 17th, 2008 at 12:39 PM.
-
May 17th, 2008, 05:26 PM
#5
Thread Starter
Hyperactive Member
Re: Web Browser New Window
i am using the web browser with brwWebBrowser
-
May 18th, 2008, 02:07 PM
#6
Thread Starter
Hyperactive Member
Re: Web Browser New Window
-
May 18th, 2008, 03:00 PM
#7
Re: Web Browser New Window
-
May 18th, 2008, 03:09 PM
#8
Thread Starter
Hyperactive Member
Re: Web Browser New Window
 Originally Posted by jmsrickland
Did you try #2
yes, and it will create a new window when it calls for a new window, but its always blank
can i display what the new window would/should actually contain?
Code:
Private Sub brwWebBrowser_NewWindow2(ppDisp As Object, Cancel As Boolean)
MsgBox ("New window detected")
Dim frm1 As frmBrowser
Set frm1 = New frmBrowser
frm1.brwWebBrowser.RegisterAsBrowser = True
Set ppDisp = frmBrowser.brwWebBrowser.object
frm1.Show
frm1.brwWebBrowser.Visible = True
frm1.cboAddress = frmBrowser.cboAddress
frm1.brwWebBrowser.Navigate frm1.cboAddress
End Sub
this works fine for making a new window inside the MDI browser with the same address as the first browser window, but i want it to go to the DESTINATION of the new window link
Last edited by Philly0494; May 18th, 2008 at 03:14 PM.
-
May 18th, 2008, 03:44 PM
#9
Re: Web Browser New Window
Do it like I showed you
Code:
Private Sub brwWebBrowser_NewWindow2(ppDisp As Object, Cancel As Boolean)
MsgBox ("New window detected")
Dim frm1 As frmBrowser
Set frm1 = New frmBrowser
frm1.brwWebBrowser.RegisterAsBrowser = True
Set ppDisp = frm1.brwWebBrowser.object
frm1.Visible = True
End Sub
-
May 18th, 2008, 03:48 PM
#10
Thread Starter
Hyperactive Member
Re: Web Browser New Window
 Originally Posted by jmsrickland
Do it like I showed you
Code:
Private Sub brwWebBrowser_NewWindow2(ppDisp As Object, Cancel As Boolean)
MsgBox ("New window detected")
Dim frm1 As frmBrowser
Set frm1 = New frmBrowser
frm1.brwWebBrowser.RegisterAsBrowser = True
Set ppDisp = frm1.brwWebBrowser.object
frm1.Visible = True
End Sub
yeah, that does less, it just opens up a blank web page, my updates the web page to the current window's address.
i wanted the new window to load the link's address, not the current pages' address
are you sure that it did that for you?
-
May 18th, 2008, 06:18 PM
#11
Re: Web Browser New Window
That code using the same names as you use works perfect for me.
I tested it with the following:
vbforums.com-->Visual Basic 6 and Earlier-->File Association thread-->Click on first link in post #2.
That code opens up that link in a new window (a whole new Form with a browser window) that belongs to my VB application
If you are getting only a blank page then there is something else going on with your program that I don't know about.
Try this:
Temporarily do not use the sub brwWebBrowser_NewWindow2. Rename it or something.
Now using your application do everything the same and see if you get a good page in a new window but it will be IE's Form, not yours.
If you get a blank page then that should tell you something but if you get a good page then that code should also give you the same exact page but only in your app's new window. If not then I need to see the rest of your code to see if I can find what's going on.
-
May 18th, 2008, 06:36 PM
#12
Thread Starter
Hyperactive Member
Re: Web Browser New Window
Last edited by Philly0494; May 18th, 2008 at 06:39 PM.
-
May 19th, 2008, 03:25 AM
#13
Lively Member
Re: Web Browser New Window
I used browser 2.0 library.
I got rid of the midichild stuff and I did make custom callbacks.
it's not complete. But here is a downized image of it.
I have it where you can set custom colors on the options page.
http://i56.photobucket.com/albums/g1...mybroswer1.jpg
I used my own Buttons instead of tabstrip.
Some simple code used.
Code:
Private Sub Cmd1_Click() ''Starts the command Sub
On Error GoTo a:
brwWebBrowser.GoBack
a: 'Refresh
End Sub
Private Sub Cmd2_Click()
On Error GoTo a:
brwWebBrowser.Gofoward '' Goes back to the previous page
a: 'Refresh
End Sub
Private Sub Cmd3_Click()
On Error GoTo a:
brwWebBrowser.GoHome '' Goes to the home page
a: 'Refresh
End Sub
Private Sub Cmd4_Click()
On Error GoTo a:
brwWebBrowser.Refresh '' Refresh
a: 'Refresh
End Sub
Private Sub Cmd5_Click()
On Error GoTo a:
brwWebBrowser.Navigate CboAddress
CboAddress.SetFocus
a: 'Refresh
End Sub
Private Sub Window_Click()
ShellExecute hWnd, vbNullString, (App.Path & "\MyBrowser.exe"), _
vbNullString, vbNullString, vbNormalFocus
End Sub
I misunderstood the question.
I didnt have the link set to open new window yet.
I do now. Thanks.
The problem now is getting the new window to open with my preferences for the first window.
My color scheme isn't loading.
.
Last edited by Jabber; May 19th, 2008 at 03:59 AM.
-
Jun 5th, 2008, 07:00 PM
#14
Member
Re: Web Browser New Window
Here is my code.
Note: your objects can meet the requirements, but be careful. Rename if nescessary, or you'll get an error.
Code:
Private Function Popups() As Boolean
Dim frmAds As Form
Dim ppDisp As Object
Dim Cancel As Boolean
Set frmAds = New frmWebBrowser
Set ppDisp = frmAds.WebBrowser1.Object
If Popups = False Then
Cancel = False
frmAds.Visible = True And Fasle
Unload frmAds
End If
End Function
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Dim frmNewWindow As Form, Popups As Boolean
Set frmNewWindow = New frmWebBrowser
Set ppDisp = frmNewWindow.WebBrowser1.Object
WebBrowser1.RegisterAsBrowser = True
frmNewWindow.Show
Popups = False
End Sub
This code is a Popup blocker and New window opener
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
|