-
Launch Default Web Browser
Hi,
Can someone tell me how to lauch a system default browser without
supplying an html web link. i.e. it goes into default home page.
Thanks
Abdulla
-
Re: Launch Default Web Browser
Hi Abdulla
You can do it this way,
Dim strBrowserPath As String
strBrowserPath = GetExePath("htm")
If strBrowserPath <> "NoDefApp" Then Shell(strBrowserPath, vbNormal)
*********************
Option Explicit
Private Declare Function FindExecutable Lib "shell32.dll" Alias _
"FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, _
ByVal lpResult As String) As Long
Public Function GetExePath(Extension As String) As String
Dim Result As String, z As Long, Path As String
Dim FileName As String, fnum As Integer
If Extension = "" Then
GetExePath = "NoExtension"
Exit Function
End If
If Left$(Extension, 1) = "." Then _
Extension = Right$(Extension, Len(Extension) - 1)
Result = Space$(270)
Path = Environ("temp") & "\"
FileName = "~testing." & Extension
fnum = FreeFile
Open Path & FileName For Output As #fnum
Close #fnum
z = FindExecutable(FileName, Path, Result)
Kill Path & FileName
Do While fnum > 0
fnum = InStr(Result, Chr(0))
If fnum > 0 Then Mid(Result, fnum, 1) = " "
Loop
Result = Trim(Result)
fnum = InStr(1, Result, ".EXE", vbTextCompare)
If Len(Result) > 0 And fnum > 0 Then
Result = Left$(Result, fnum) & "EXE"
GetExePath = Result
Else
GetExePath = "NoDefApp"
End If
End Function
***********************************
regards
Ian
** invalid email address, change dk to denmark
homepage http://www.kingsoft-denmark.com/
Abdulla Hussein Al-Adhal <aladhal@metastorm.com> wrote in message
news:3961c896$1@news.devx.com...
> Hi,
> Can someone tell me how to lauch a system default browser without
> supplying an html web link. i.e. it goes into default home page.
>
> Thanks
> Abdulla
>
>
-
Re: Launch Default Web Browser
Hi Abdulla
You can do it this way,
Dim strBrowserPath As String
strBrowserPath = GetExePath("htm")
If strBrowserPath <> "NoDefApp" Then Shell(strBrowserPath, vbNormal)
*********************
Option Explicit
Private Declare Function FindExecutable Lib "shell32.dll" Alias _
"FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, _
ByVal lpResult As String) As Long
Public Function GetExePath(Extension As String) As String
Dim Result As String, z As Long, Path As String
Dim FileName As String, fnum As Integer
If Extension = "" Then
GetExePath = "NoExtension"
Exit Function
End If
If Left$(Extension, 1) = "." Then _
Extension = Right$(Extension, Len(Extension) - 1)
Result = Space$(270)
Path = Environ("temp") & "\"
FileName = "~testing." & Extension
fnum = FreeFile
Open Path & FileName For Output As #fnum
Close #fnum
z = FindExecutable(FileName, Path, Result)
Kill Path & FileName
Do While fnum > 0
fnum = InStr(Result, Chr(0))
If fnum > 0 Then Mid(Result, fnum, 1) = " "
Loop
Result = Trim(Result)
fnum = InStr(1, Result, ".EXE", vbTextCompare)
If Len(Result) > 0 And fnum > 0 Then
Result = Left$(Result, fnum) & "EXE"
GetExePath = Result
Else
GetExePath = "NoDefApp"
End If
End Function
***********************************
regards
Ian
** invalid email address, change dk to denmark
homepage http://www.kingsoft-denmark.com/
Abdulla Hussein Al-Adhal <aladhal@metastorm.com> wrote in message
news:3961c896$1@news.devx.com...
> Hi,
> Can someone tell me how to lauch a system default browser without
> supplying an html web link. i.e. it goes into default home page.
>
> Thanks
> Abdulla
>
>
-
Re: Launch Default Web Browser
I will try that
Cheers Ian
"Ian King" <advice@kingsoft-dk.com> wrote in message
news:3962e6ff$1@news.devx.com...
> Hi Abdulla
>
> You can do it this way,
>
> Dim strBrowserPath As String
> strBrowserPath = GetExePath("htm")
> If strBrowserPath <> "NoDefApp" Then Shell(strBrowserPath, vbNormal)
>
> *********************
> Option Explicit
>
> Private Declare Function FindExecutable Lib "shell32.dll" Alias _
> "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, _
> ByVal lpResult As String) As Long
>
> Public Function GetExePath(Extension As String) As String
> Dim Result As String, z As Long, Path As String
> Dim FileName As String, fnum As Integer
> If Extension = "" Then
> GetExePath = "NoExtension"
> Exit Function
> End If
> If Left$(Extension, 1) = "." Then _
> Extension = Right$(Extension, Len(Extension) - 1)
> Result = Space$(270)
> Path = Environ("temp") & "\"
> FileName = "~testing." & Extension
> fnum = FreeFile
> Open Path & FileName For Output As #fnum
> Close #fnum
> z = FindExecutable(FileName, Path, Result)
> Kill Path & FileName
> Do While fnum > 0
> fnum = InStr(Result, Chr(0))
> If fnum > 0 Then Mid(Result, fnum, 1) = " "
> Loop
> Result = Trim(Result)
> fnum = InStr(1, Result, ".EXE", vbTextCompare)
> If Len(Result) > 0 And fnum > 0 Then
> Result = Left$(Result, fnum) & "EXE"
> GetExePath = Result
> Else
> GetExePath = "NoDefApp"
> End If
> End Function
> ***********************************
>
> regards
>
> Ian
>
> ** invalid email address, change dk to denmark
>
> homepage http://www.kingsoft-denmark.com/
>
>
> Abdulla Hussein Al-Adhal <aladhal@metastorm.com> wrote in message
> news:3961c896$1@news.devx.com...
> > Hi,
> > Can someone tell me how to lauch a system default browser without
> > supplying an html web link. i.e. it goes into default home page.
> >
> > Thanks
> > Abdulla
> >
> >
>
>
-
Re: Launch Default Web Browser
I will try that
Cheers Ian
"Ian King" <advice@kingsoft-dk.com> wrote in message
news:3962e6ff$1@news.devx.com...
> Hi Abdulla
>
> You can do it this way,
>
> Dim strBrowserPath As String
> strBrowserPath = GetExePath("htm")
> If strBrowserPath <> "NoDefApp" Then Shell(strBrowserPath, vbNormal)
>
> *********************
> Option Explicit
>
> Private Declare Function FindExecutable Lib "shell32.dll" Alias _
> "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, _
> ByVal lpResult As String) As Long
>
> Public Function GetExePath(Extension As String) As String
> Dim Result As String, z As Long, Path As String
> Dim FileName As String, fnum As Integer
> If Extension = "" Then
> GetExePath = "NoExtension"
> Exit Function
> End If
> If Left$(Extension, 1) = "." Then _
> Extension = Right$(Extension, Len(Extension) - 1)
> Result = Space$(270)
> Path = Environ("temp") & "\"
> FileName = "~testing." & Extension
> fnum = FreeFile
> Open Path & FileName For Output As #fnum
> Close #fnum
> z = FindExecutable(FileName, Path, Result)
> Kill Path & FileName
> Do While fnum > 0
> fnum = InStr(Result, Chr(0))
> If fnum > 0 Then Mid(Result, fnum, 1) = " "
> Loop
> Result = Trim(Result)
> fnum = InStr(1, Result, ".EXE", vbTextCompare)
> If Len(Result) > 0 And fnum > 0 Then
> Result = Left$(Result, fnum) & "EXE"
> GetExePath = Result
> Else
> GetExePath = "NoDefApp"
> End If
> End Function
> ***********************************
>
> regards
>
> Ian
>
> ** invalid email address, change dk to denmark
>
> homepage http://www.kingsoft-denmark.com/
>
>
> Abdulla Hussein Al-Adhal <aladhal@metastorm.com> wrote in message
> news:3961c896$1@news.devx.com...
> > Hi,
> > Can someone tell me how to lauch a system default browser without
> > supplying an html web link. i.e. it goes into default home page.
> >
> > Thanks
> > Abdulla
> >
> >
>
>
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks