|
-
Dec 4th, 2000, 12:36 PM
#1
Thread Starter
New Member
All im trying to do is open an Internet Browser and make it go to a specifik URL. Now okay, that i can get working. The problem is, that when i have a browser open - lets say on yahoo.com - and i run the "open browser and goto url" part of my code, it will take my current browser - the one thats on yahoo.com - and go away from yahoo to the URL. The idea is to get the browser to open up a new window with the URL.
This cannot be to heard for someone with a little experience? I have been on the search for a long time now, so i really hope someone can help me out here.
-
Dec 4th, 2000, 12:47 PM
#2
This works for me....
Just replace the url with yours...
even if the setting to re-use same window for shortcuts is enabled...this should work.
If it does not...It may be something in one of you IE option settings.
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Dec 4th, 2000, 12:52 PM
#3
Thread Starter
New Member
That partially works. I mean to say that if the PATH to IE is a little different on some other computer it won't work. Or if the client might be using Netscape. Maybe you could do a workaround, by somehow getting the path for the default browser. But i don't know if thats possible, don't know that much about vb.
Michael J
-
Dec 4th, 2000, 12:56 PM
#4
Frenzied Member
Here ya gowww 
Code:
Public 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 Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
Public Sub Navigate(Url As String)
Dim sEXE As String
sEXE = FindBrowserEXE
If Len(sEXE) Then
ShellExecute hWnd, "OPEN", sEXE, Url, "", 1
End If
End Sub
Function FindBrowserEXE() As String
Dim sPath As String
Dim iFile As Integer
sPath = space(255)
iFile = FreeFile
Open "C:\Temp.htm" For Output As iFile
Close iFile
'this part isn't mine, can't remember where I got it.
FindBrowserEXE = Left(sPath, FindExecutable("C:\Temp.htm", "", ByVal sPath))
Kill "C:\Temp.htm"
End Function
Place it in a module and run
Code:
Navigate "http://www.cool.com"
Hope that helps
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Dec 4th, 2000, 01:15 PM
#5
Thread Starter
New Member
This might be a dumb question but, how come it has a problem with this line:
ShellExecute hWnd, "OPEN", sEXE, Url, "", 1
It says that the "hWnd" variable is not defined?
Michael J
-
Dec 4th, 2000, 01:19 PM
#6
Thread Starter
New Member
That partially works. I mean to say that if the PATH to IE is a little different on some other computer it won't work. Or if the client might be using Netscape. Maybe you could do a workaround, by somehow getting the path for the default browser. But i don't know if thats possible, don't know that much about vb.
Michael J
-
Dec 4th, 2000, 01:20 PM
#7
Lively Member
I'm possibly very wrong here as I'm only learning this, but try ShellExecute.hWnd.
Sorry if I'm wrong
The problem with designing something completely foolproof is to underestimate the ingenuity of a complete fool. - Douglas Adams
I know the human being and fish can coexist peacefully. - GWB
I think we agree, the past is over. - GWB
-
Dec 4th, 2000, 01:37 PM
#8
Frenzied Member
ah.. nothing big,just put Form1.hWnd
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Dec 7th, 2000, 04:34 AM
#9
Thread Starter
New Member
The post that >Job< sent worked fine on my computer. However, when I tried it on another computer, it did not work - more specific, it could not find the path of the program associated with the file c:\temp.htm.
A guy in need of help! Michael J
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
|