|
-
Dec 22nd, 2008, 01:03 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] How to call a web browser?
Hi, I writing a program and one of the features is calling a web browser. I need to execute a web browser and load with the address that i have specified in my code. How can i do that? Is that necessary to use Web Browser Control in the VB? I didn't use it before so kinda new to this control. Any advise?
I'm still on the path of learning.... 
-
Dec 22nd, 2008, 01:27 AM
#2
Addicted Member
Re: How to call a web browser?
Public Function OpenBrowser(ByVal URL As String) As Boolean
Dim res As Long
' it is mandatory that the URL is prefixed with http:// or https://
If InStr(1, URL, "http", vbTextCompare) <> 1 Then
URL = "http://" & URL
End If
res = ShellExecute(0&, "open", URL, vbNullString, vbNullString, _
vbNormalFocus)
OpenBrowser = (res > 32)
End Function
IT CTO & System Administrator.
-
Dec 22nd, 2008, 01:32 AM
#3
Re: How to call a web browser?
Hello @yosef_mreh! Next time you post a code, please place your code inside the code tags, to let the forum engine formating it, to a suitable format. You can do it by simply clicking on the (Code) button up the edit box's toolbar, there you typing.
There is also an api call is missing here, he/she cant use your code, without it.
http://allapi.mentalis.org/apilist/ShellExecute.shtml
-
Dec 22nd, 2008, 01:36 AM
#4
Addicted Member
Re: How to call a web browser?
or using the consol shell:
vb Code:
Shell "explorer.exe http://www.gegalo.com", vbNormalFocus
IT CTO & System Administrator.
-
Dec 22nd, 2008, 01:37 AM
#5
Re: How to call a web browser?
this might help
goto Add-in > API Viewer and referrence to ShellExecute api.
Code:
Public Function OpenWebpage(strWebpage As String)
ShellExecute 0&, vbNullString, strWebpage, vbNullString, _
vbNullString, vbNormalFocus
End Function
Code:
Private Sub Command1_Click()
OpenWebpage "http://www.vbforums.com/showthread.php?t=551194"
End Sub
-
Dec 22nd, 2008, 10:50 AM
#6
Thread Starter
Hyperactive Member
Re: How to call a web browser?
yeah...it's work. Thanks a lot to everyone.
I'm still on the path of learning.... 
-
Dec 22nd, 2008, 04:52 PM
#7
Lively Member
Re: [RESOLVED] How to call a web browser?
also u can use firefox
Code:
Shell "C:\Program Files\Mozilla Firefox\firefox.exe www.google.com"
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
|