iNET Interactive - Online Advertising Agency
          
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Communications > Webbrowser control


Reply
 
Thread Tools Display Modes
  #1  
Old 01-09-2003, 03:39 PM
Cogen's Avatar
Cogen Cogen is offline
Contributor
 
Join Date: Apr 2002
Location: Ontario, Canada
Posts: 673
Default Webbrowser control

I'm not sure if this should be in a web forum or not, but half of it has to do with vb, and the other half is on the web.

I made a vb application that has a webbrowser control. All I want is to make the web page only viewable through the application. I do not want to pass a variable in the url string of the webbrowser control, therefore I'm wondering if there is some way to change the User Agent information of the webbrowser control? Or maybe set something else in the control that I can test on the web page?
Any help would be great .
__________________
"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
Reply With Quote
  #2  
Old 01-09-2003, 03:49 PM
OnErr0r's Avatar
OnErr0r OnErr0r is offline
Obsessive OPtimizer
Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 12,882
Default

No, but you could use the winsock control instead and specify anything you like
__________________
Quis custodiet ipsos custodues.
Reply With Quote
  #3  
Old 01-09-2003, 04:06 PM
Cogen's Avatar
Cogen Cogen is offline
Contributor
 
Join Date: Apr 2002
Location: Ontario, Canada
Posts: 673
Default

Okay, thank you.

I've never used winsock before so I'm going to do a little reading here and on wincockvb.com, but just out of curiosity how would that be structured? Can the winsock control display webpages, or do I connect to the server with the winsock control and pass the info to a webbrowser control, or is it another senario?
__________________
"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
Reply With Quote
  #4  
Old 01-09-2003, 04:08 PM
OnErr0r's Avatar
OnErr0r OnErr0r is offline
Obsessive OPtimizer
Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 12,882
Default

As a matter of fact.. I just made a post with a "mini-browser"

http://www.xtremevbtalk.com/show...threadid=55900
__________________
Quis custodiet ipsos custodues.
Reply With Quote
  #5  
Old 01-09-2003, 04:31 PM
Cogen's Avatar
Cogen Cogen is offline
Contributor
 
Join Date: Apr 2002
Location: Ontario, Canada
Posts: 673
Default

That looks great OnErrOr ... I'm having a problem though. You mention making a reference to the winsock control, but I can't find it in Project - References. Do I need to download it from somewhere first?

Edit:
Oops .. never mind, I found it. Thanks.
__________________
"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Last edited by Cogen : 01-09-2003 at 04:42 PM.
Reply With Quote
  #6  
Old 01-09-2003, 06:16 PM
Cogen's Avatar
Cogen Cogen is offline
Contributor
 
Join Date: Apr 2002
Location: Ontario, Canada
Posts: 673
Default

Sorry, but I'm struggling a bit here. If I get winsock to return a string containing a web page, then how do I display it? Do I need to save it as an html file? If I display it in a webbrowser control, then the webbrowser will take over as the host instead of winsock. This isn't good because as soon as the user click on a link, the webbrowser will do all the work instead of winsock.
__________________
"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Last edited by Cogen : 01-09-2003 at 06:39 PM.
Reply With Quote
  #7  
Old 01-09-2003, 06:40 PM
ChiefRedBull's Avatar
ChiefRedBull ChiefRedBull is offline
ISearchGoogle
Retired Moderator
* Expert *
 
Join Date: May 2001
Location: england
Posts: 6,321
Default

You'd have to save it, then use a WebBrowser to display it.
__________________
Chuck Norris ordered a Big Mac at Burger King, and got one.
Reply With Quote
  #8  
Old 01-09-2003, 06:52 PM
Cogen's Avatar
Cogen Cogen is offline
Contributor
 
Join Date: Apr 2002
Location: Ontario, Canada
Posts: 673
Default

Thanks for the reply ChiefRedBull .
The problem is that I'm going to be passing information (header, or specific user agent string if possible) to the website through winsock. On the server side (PHP), I'm not going to allow anyone to view the site unless the header information is present. Therefore, if I save it as an html file and display it in a webbrowser control, the webbrowser control will take the data transfer responsibilities away from winsock, and it will not send the proper headers/useragent when the user navigates the site.
Does that make sense .. hehe (i hope). Is this even possible?
__________________
"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
Reply With Quote
  #9  
Old 01-09-2003, 07:09 PM
ChiefRedBull's Avatar
ChiefRedBull ChiefRedBull is offline
ISearchGoogle
Retired Moderator
* Expert *
 
Join Date: May 2001
Location: england
Posts: 6,321
Default

Cogen - you are misunderstanding. Once you've received and
saved the HTML from your server, it is displayed locally. The WB
control will only access the server for the images.. that's ok isn't
it?
__________________
Chuck Norris ordered a Big Mac at Burger King, and got one.
Reply With Quote
  #10  
Old 01-09-2003, 11:24 PM
Cogen's Avatar
Cogen Cogen is offline
Contributor
 
Join Date: Apr 2002
Location: Ontario, Canada
Posts: 673
Default

Yes, accessing the server for the images is fine. I understand that the html file will be stored locally, but my problem is that the local html file will have *a href=* links to other pages on the site. When the user clicks on those links, the webbrowser will go to the page, and that page will not be local, but on the server. From that point on, the webbrowser control handles everything, rather then winsock.
__________________
"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
Reply With Quote
  #11  
Old 01-10-2003, 04:58 AM
ChiefRedBull's Avatar
ChiefRedBull ChiefRedBull is offline
ISearchGoogle
Retired Moderator
* Expert *
 
Join Date: May 2001
Location: england
Posts: 6,321
Default

You can interrupt it - the WebBrowser has a BeforeNavigate
event, which you can cancel, then use the Winsock to download
the link that was clicked.
__________________
Chuck Norris ordered a Big Mac at Burger King, and got one.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Forum Jump

Advertisement: