Jump to content


Photo
- - - - -

[vb] ShellExecute API Launch URL Default Browser


  • Please log in to reply
No replies to this topic

#1 Boom

Boom

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 21 December 2005 - 04:50 PM

I throught I'd just post this as I was reading a thread in the desktop programming and was gonna reply but its locked so I'm putting this here for anyone interested as the method implemented in that thread in my own opinion is bad.

http://www.pixel2lif...?showtopic=8212

Shell ("explorer URL")

will simply launch the website in internet explorer but hey we dont all use that browser, personally I'm a fan of firefox so this is the correct way to launch a URL in visual basic that will open it in the users default browser and is a much better alternative in my opinion.

Input into a module.

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

Public Function OpenWebpage(strWebpage As String)
ShellExecute 0&, vbNullString, strWebpage, vbNullString, _
	  vbNullString, vbNormalFocus
End Function

Call from within a form's code window:

Call OpenWebpage("http://mywebsite.com")





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users