Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 1st, 2003, 10:12 AM
PhilRulerOfHeck PhilRulerOfHeck is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 4 PhilRulerOfHeck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How to load webpage in VB6?

I would like to open a webpage (text files) in Visual Basic 6, and store the results in an array. I don't want the user to see the webpage opening up, like running shell explorer or shell start. I found quite a few examples online, but none of them worked. In Perl, this is all the I would have to do:

PHP Code:
use LWP::Simple;
local $www='http://www.google.com';
my @ray=get $www


I am an Unix (C, Perl, Shells, etc) programmer, and this is one of my first attempts at Windows programming. So, please be kind and help me out.

Thank you

Reply With Quote
  #2  
Old December 1st, 2003, 10:51 AM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,982 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 18 h 42 m 27 sec
Reputation Power: 814
Search the msdn library for info on the webbrowser control.

Reply With Quote
  #3  
Old December 1st, 2003, 01:47 PM
PhilRulerOfHeck PhilRulerOfHeck is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 4 PhilRulerOfHeck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Doug,

Reading the MSDN library is very difficult, and not productive from a newbie point of view. Is there an example that I could look at?

Thank you

Reply With Quote
  #4  
Old December 1st, 2003, 03:34 PM
PhilRulerOfHeck PhilRulerOfHeck is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 4 PhilRulerOfHeck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile More help needed

I successfully created a WebBrowser1 control. I still have a few question through. Can I not view the URL? I made the height and width both set to 0, but that results with a dot on the screen.

Also, how do I parse the URL data?

Reply With Quote
  #5  
Old December 1st, 2003, 11:13 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,982 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 18 h 42 m 27 sec
Reputation Power: 814
Use the visible property to hide the control

WebBrowser1.Visible = false

To get the URL use

MyString = WebBrowser1.LocationURL

You normally will use the Navigate or Navigate2 method to open a URL with the control, and then wait for the DocumentComplete event. After the DocumentComplete event, you can get the page source using

strHTML = WebBrowser1.Document.InnerHTML

Reply With Quote
  #6  
Old December 2nd, 2003, 09:47 AM
PhilRulerOfHeck PhilRulerOfHeck is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 4 PhilRulerOfHeck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Doug,

For some reason, when I hide the control, the webpage does not appears to be opening at all.

WebBrowser1.Visible = false

Here is my code:
PHP Code:
 WebBrowser1.Navigate URL
Dim buf
() As Byte
buf 
Inet1.OpenURL(URL


PHP Code:
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As ObjectURL As Variant)
  
'ShowStatusMsg ""


  Dim strHTML As String
  strHTML = WebBrowser1.Document.body.InnerHTML
  MsgBox strHTML
  
  '
Exit
  
Unload Me
End Sub 


Any ideas?

My next question, is how do I parse data out of the strHTML String? The string is delimited with a couple of EOLN. Is there a split function in Visual Baic like Perl?

Thank you again

Reply With Quote
  #7  
Old December 2nd, 2003, 02:57 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,982 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 18 h 42 m 27 sec
Reputation Power: 814
Yes, VB has a split function. This link will take you to the top of the VB6 refrence documentation for the VB functions, objects, and VB-distributed controls.

http://msdn.microsoft.com/library/e...cLROverview.asp

About not opening the web page, perhaps the webbrowser control is inactive if not visible? I've never tried using it while not visible. There is also an Internet Transfer control that may work for you, for the documentation on that control look in the controls section of the reference documentation from the above link.

Oh, try using the Navigate2 method.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > How to load webpage in VB6?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT