Solved

100 pts for urgent question 2

Posted on 2002-03-05
6
139 Views
Last Modified: 2010-05-02
how to open a website/URL from VB?
0
Comment
Question by:wuyinzhi
6 Comments
 
LVL 50

Accepted Solution

by:
Ryan Chong earned 80 total points
ID: 6841175
Private 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
Private Const SW_SHOW = 5

ShellExecute Me.hwnd, "open", Trim$(txtWebsite.Text), vbNullString, vbNullString, SW_SHOW
0
 
LVL 28

Expert Comment

by:Ark
ID: 6841178
Hi
Private 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 Sub NavigateTo(sUrl As String)
   Call ShellExecute(0&, vbNullString, sUrl, vbNullString, vbNullString, vbNormalFocus)
End Sub

Cheers
0
 

Expert Comment

by:aseem_dayal
ID: 6841359
Hi,

See if this helps :

1. Go to your project refferences and select "Microsoft    
   Internet Controls", which is a refference to shdocvw.dll

2. Add the following code for a command button click :

Dim ws As SHDocVw.InternetExplorer

Private Sub Command1_Click()

Set ws = New InternetExplorer

ws.Visible = True
ws.Navigate ("www.google.com")

End Sub

To use alternative browsers use the WebBrowser class included in this library.

0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 8

Expert Comment

by:vettranger
ID: 6841873
Or, if you need to see the web page code from inside your VB program :

url$ = "http://www.something.com"
q$ = Inet1.OpenURL(url$)

q$ now has the code from the web page to parse as you'd like.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6842066
:))
0
 
LVL 3

Author Comment

by:wuyinzhi
ID: 6843508
thanks all, especially to ryancys who gave me the solution first. Anyway just curious, is it possible to access an asp page without open the browser?
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question