|
-
Oct 5th, 2000, 07:33 PM
#1
Thread Starter
Addicted Member
how do you get a web page into a vb form? I am not looking for just the picture. I want the actual page to be in the form, like my own browser.
Thanx
-
Oct 5th, 2000, 07:37 PM
#2
Use the Webbrowser Control (ShDocVw.dll) which is a part of IE. It is located in the Custom Controls (Ctrl+T) under Microsoft Internet Controls.
Commands mostly used:
Code:
'Go to the previous webpage
WebBrowser1.GoBack
'Go to the present webpage
WebBrowser1.GoForward
'Go to the default IE home
WebBrowser1.GoHome
'Go to the default search page
WebBrowser1.GoSearch
'Refresh the current webpage
WebBrowser1.Refresh
'Navigate to a webpage
WebBrowser1.Navigate "www.vb-world.net"
-
Oct 5th, 2000, 07:39 PM
#3
Thread Starter
Addicted Member
Thanx for the quick response. also, I posted this yesterday. Do you know how to login with an x id. I am on a t1 line.
-
Oct 5th, 2000, 07:44 PM
#4
Thread Starter
Addicted Member
Matthrew, what you posted on the Microsoft Inet Control will make a new instance of IE. I was wondering if you know a way to view that right on one of my child form?
-
Oct 5th, 2000, 07:52 PM
#5
Wow, I did respond quick, didn't even realize it.
Here is the thread that shows what you want to do.
And I'm not sure how to log on to an x id..whatever that is .
-
Oct 5th, 2000, 08:02 PM
#6
Thread Starter
Addicted Member
Sorry for being slow, but I am still lost with your example.
There are two controls under that dll. what is the ShellFileViewOC?
-
Oct 5th, 2000, 08:08 PM
#7
Did you accidently go to References? To do it manually, click on Browse or whatever is there to select a ocx file, and located in the C:\Windows\System directory with a file called ShDocVw.dll. You are talking about the Custom Controls, aren't you? There should be one named Microsoft Internet Controls.
-
Oct 5th, 2000, 08:18 PM
#8
Thread Starter
Addicted Member
I did what you told to do. control T. when I checked on it, there are two controls that appears. the browsers and the ShellFolderViewOC.
I pasted your codes on too the form, but still nothing appears.
Thanx for helping Mattrew.
Private Sub Form_Click()
Dim ppDisp As Object
Dim F As New Form1
Set ppDisp = F.WebBrowser1.object
F.Show
End Sub
-
Oct 5th, 2000, 08:29 PM
#9
When you went into Custom Controls (Ctrl+T), did you do the other alternative: click on Browser... and select C:\Windows\System\ShDocVw.dll ? After you select it, it should automatically put it in the list and go to it, than you just make sure it's checked and click OK.
-
Oct 5th, 2000, 08:37 PM
#10
Thread Starter
Addicted Member
Sorry if I am confusing you. I got the control on my form already. It has an icon of the earth. I dropped the control on my form but still don't see any http://www.yahoo.com on my form. again, i don't have trouble locating the control, but why isn't the webbrowser control displaying the yahoo site?
-
Oct 5th, 2000, 08:39 PM
#11
Thread Starter
Addicted Member
thanx for your help. I got it working now. I pasted the code above into it. thanx again Matthrew.
-
Oct 5th, 2000, 08:43 PM
#12
Curious:
Did you forget to navigate to the site?
Code:
Private Sub Form_Load()
Webbrowser1.Navigate "http://www.yahoo.com"
End Sub
-
Oct 5th, 2000, 08:44 PM
#13
Thread Starter
Addicted Member
You guess right!
-
Oct 5th, 2000, 09:57 PM
#14
Thread Starter
Addicted Member
How can I view the addressbar? I set it to true already but it is not visible.
I ask you this earlier about x id. It is another name for the network id. at my company, to login to the internet, I have to enter the network id. do you know how to enter it through codes?
Thanx
[Edited by Shark on 10-06-2000 at 01:06 AM]
-
Oct 6th, 2000, 02:22 PM
#15
I don't think the address bar would show and I have no idea why. Make your own.
Code:
Private Sub Command1_Click()
Webbrowser1.Navigate Combo1.text
End Sub
And if you want to have a status bar:
Code:
Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
Label1.Caption = Text
End Sub
For the x id, I think you have to do it yourself..unless you use SendKeys to do it.
And if you need help with anything else for the Webbrowser Control, just ask.
-
Oct 6th, 2000, 03:06 PM
#16
Thread Starter
Addicted Member
You are great. Make others people lifes come easier. Thanx so much!
-
Oct 6th, 2000, 03:24 PM
#17
Thread Starter
Addicted Member
OK, I thought of a question for you. I got this code from you. you posted for someone somewhere.
webbrowser1.execwb savecopyas, donotprompt
How come it still prompt me when I wanted to save a jpeg?
-
Oct 6th, 2000, 08:40 PM
#18
Webbrowser Control is just like that. It always prompts you for stuff. If you look in the Object Browser at the Webbrowser Control, you will see many things in it. Some of those things work...and some don't. It gives you an error when you try to do certain things. Even if you download IE 5.5, it still does it. I guess Microsoft can't work out every bug(s) . I guess your going to have to...
Live it, learn it, love it.
By the way, are you wanting to save everything on the Web page? Here is how you do it:
Code:
WebBrowser1.ExecWB OLECMDID_SAVEAS,OLECMDEXECOPT_PROMPTUSER
Notice: If you switch PROMPTUSER to DONTPROMPTUSER, it does not work. The user must choose where it is to be saved.
-
Oct 7th, 2000, 03:19 AM
#19
Thread Starter
Addicted Member
Thanks Matthrew. I just thought of an idea. I am using IE5 on Win2k. When you load a picture or a file, it has to cache out to somewhere. So, instead of using Webbrowser1.Execwb, why not just copy it from the cache? This way the save dialog box can be avoid. Only problem is where does it cache out the file? Have any ideas?
-
Oct 7th, 2000, 03:38 AM
#20
Fanatic Member
The folder where it's cached is "C:\WINDOWS\Temporary Internet Files"
-
Oct 7th, 2000, 03:49 AM
#21
Thread Starter
Addicted Member
Thanks for the reply Oetje
That might be on win9x but not on win2k.
I have two more questions Matthrew.
Web.Document.Forms(0).login.Value
What else can I do with Document and why is Forms(0) but not Forms(1222). What does the zero represent?
Thanks
-
Oct 7th, 2000, 09:30 AM
#22
Fanatic Member
Re: Thanks for the reply Oetje
Originally posted by Shark
Why is Forms(0) but not Forms(1222). What does the zero represent?
If you ever studied html, then you know the <form> tag. A form is a piece in an html that contains controls. Controls like command buttons, text buttons, etc. Forms(0) means the first form in the web page.
-
Oct 7th, 2000, 04:30 PM
#23
Thread Starter
Addicted Member
thanks oetje - i see now
This is for Matthrew.
Matthrew. I just thought of an idea. I am using IE5 on Win2k. When you load a picture or a file, it has to cache out to somewhere. So, instead of using Webbrowser1.Execwb, why not just copy it from the cache? This way the save dialog box can be avoid. Only problem is where does it cache out the file? Have any ideas?
-
Oct 7th, 2000, 05:24 PM
#24
Fanatic Member
Chemically Formulated As:
Dr. Nitro
-
Oct 7th, 2000, 05:36 PM
#25
Thread Starter
Addicted Member
Thanks Nitro.
While looking at that site, I stumble into URLDownloadToCacheFile. Can you show me how to use that too.
-
Oct 9th, 2000, 03:44 PM
#26
New Member
Hey shark ,
no need to use the web browser control.
insert a module declare this api call ...
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Declare Function GetActiveWindow Lib "user32" () As Long
then ...
Private Sub mnuGotoURL_Click()
surl = "http://www.vb-world.net"
ShellExecute GetActiveWindow(), "Open", surl, "", 0&, 1
End Sub
hope this solves ya prob ....
later .... 
-
Oct 9th, 2000, 04:09 PM
#27
Thread Starter
Addicted Member
Thanks so much for your reply ActiveX
Thanks but I don't want to open a new IE browser because I need the end user to browse in the form of my project.
Using the ShellExecute will launch a new instance.
-
Oct 9th, 2000, 04:37 PM
#28
Originally posted by Shark
Thanks Nitro.
While looking at that site, I stumble into URLDownloadToCacheFile. Can you show me how to use that too.
There is an example right on Vb-World.net for how to use the URLDownloadToFile function.
-
Oct 9th, 2000, 06:29 PM
#29
Thread Starter
Addicted Member
Thanks Matthrew but I am looking how to use URLDownloadToCacheFile not URLDownloadToFile.
-
Oct 9th, 2000, 07:25 PM
#30
Thread Starter
Addicted Member
The site that nitro provided talks little about it, but provide no sytax for the api.
Thanks for looking.
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
|