Solved

100 pts for urgent question 2

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

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 27

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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now