|
-
Mar 10th, 2002, 05:42 AM
#1
Thread Starter
Lively Member
Opening a new web-page window
Hi everybody,
I got this code:
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 Sub Command1_Click()
ShellExecute 0&, vbNullString, "http://www.google.com", vbNullString, "C:\", 1
End Sub
and it works, but it replaces my last web-browser window, and I want to let it open in a new window...
anyone?
and while your reading this: how do you rename a file using vb?
Last edited by tonnic; Mar 10th, 2002 at 12:33 PM.
-
Mar 10th, 2002, 06:30 AM
#2
Thread Starter
Lively Member
common, it aint such a hard question ?
-
Mar 10th, 2002, 12:26 PM
#3
Thread Starter
Lively Member
6 hours and still nobody posted???
-
Mar 10th, 2002, 12:56 PM
#4
Originally posted by tonnic
common, it aint such a hard question ?
So you're just testing to see if we can do it? 
VB Code:
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
Private Function GetBrowserEXE() As String
Dim iFile As Integer
Dim sEXE As String
iFile = FreeFile
Open "C:\~Temp.htm" For Output As iFile
Close iFile
sEXE = Space(255)
Call FindExecutable("C:\~Temp.htm", "", ByVal sEXE)
Kill "C:\~Temp.htm"
If InStr(sEXE, Chr(0)) Then GetBrowserEXE = Left(sEXE, InStr(sEXE, Chr(0)) - 1)
End Function
Private Sub OpenInNewBrowser(ByVal sURL As String)
Call Shell(GetBrowserEXE() & " " & sURL, vbNormalFocus)
End Sub
Private Sub Command1_Click()
Call OpenInNewBrowser("http://www.vbforums.com")
End Sub
-
Mar 10th, 2002, 01:24 PM
#5
Thread Starter
Lively Member
thanks, it works!
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
|