|
-
Apr 5th, 2008, 06:48 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Opening an URL with VB (again !)
Hi !
I use this code in my VB-app, and it works fine on my computer:
*Dim A as Integer
A = Shell("C:\Program Files\Internet Explorer\IEXPLORE.exe http://www.xxx.com ", vbMaximizedFocus)*
But how do I know wether other users have IXPLORER.exe in \Program.. or in \Program Files... ? Is there any codes for covering any situations ?
/Kalle in Sweden
-
Apr 5th, 2008, 07:08 AM
#2
Re: Opening an URL with VB (again !)
try shellexecute api, there will be many examples in this forum
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Apr 5th, 2008, 07:15 AM
#3
Re: Opening an URL with VB (again !)
Start a new VB project and run this code (add a command button Command1 to the form):
Code:
Option Explicit
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
'Use API Viewer to see other constants.
Private Const SW_NORMAL = 1
Private Sub Command1_Click()
ShellExecute Me.hwnd, "open", _
"http://www.vbforums.com/newreply.php?do=newreply&noquote=1&p=3190402", _
vbNullString, vbNullString, SW_NORMAL
End Sub
-
Apr 5th, 2008, 08:23 AM
#4
Thread Starter
Addicted Member
Re: [RESOLVED] Opening an URL with VB (again !)
Thanks a lot, DigiRev !
It worked out just fine, and I have not to worry about where IE is located !
The default browser will be used as I can see...
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
|