How To Open a webpage in Defualt Browesr

*note in frist post sayd firefox but i just need this to work all help

Page 1 of 1

12 Replies - 2100 Views - Last Post: 01 February 2008 - 06:20 AM Rate Topic: -----

#1 lump121  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 30-January 08

How To Open a webpage in Defualt Browesr

Post icon  Posted 30 January 2008 - 04:29 PM

hey i want to open a webpage with a button.....

this is what i have
Private Sub cmdOpenBebo_Click()
Dim RetVel

RetVel = Shell ("C:\Program Files\Mozilla Firefox\firefox.exe", http://atworkproxy.com/index.php?q=aHR0cDovL3d3dy5iZWJvLmNvbQ%3D%3D&hl=3ed)

End Sub



i no this is not right i just wanted to show you the path that where my firefox is and most peoples. maybe you could show me how to make it check in D:\ :D that would be great thank you


*EDIT..... i need step by step instrutions i am superstuck nothing below help all errors. thanks for posting :D

This post has been edited by lump121: 30 January 2008 - 05:34 PM


Is This A Good Question/Topic? 0
  • +

Replies To: How To Open a webpage in Defualt Browesr

#2 Garrett92  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 10-July 06

Re: How To Open a webpage in Defualt Browesr

Posted 30 January 2008 - 04:36 PM

This will open it in the default browser... so if the person didn't have firefox, it would still work.

Well, you need to set this function:
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As IntPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer


then you put this under a button command or whatever you need:
ShellExecute(Nothing, "open", "http://www.google.com", "", "", AppWinStyle.NormalFocus)

Was This Post Helpful? 0
  • +
  • -

#3 lump121  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 30-January 08

Re: How To Open a webpage in Defualt Browesr

Posted 30 January 2008 - 04:44 PM

View PostGarrett92, on 30 Jan, 2008 - 04:36 PM, said:

This will open it in the default browser... so if the person didn't have firefox, it would still work.

Well, you need to set this function:
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As IntPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer


then you put this under a button command or whatever you need:
ShellExecute(Nothing, "open", "http://www.google.com", "", "", AppWinStyle.NormalFocus)




right..... i dont understand how to do this.... it is giving me pure errors? how i set funtion.... thnks for all ya help :D
Was This Post Helpful? 0
  • +
  • -

#4 Garrett92  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 10-July 06

Re: How To Open a webpage in Defualt Browesr

Posted 30 January 2008 - 04:47 PM

Just put the function under the class

It would be something like this:
Public Class FormName

	Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As IntPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		ShellExecute(Nothing, "open", "http://www.google.com", "", "", AppWinStyle.NormalFocus)
	End Sub

End Class

Was This Post Helpful? 0
  • +
  • -

#5 lump121  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 30-January 08

Re: How To Open a webpage in Defualt Browesr

Posted 30 January 2008 - 04:51 PM

View PostGarrett92, on 30 Jan, 2008 - 04:47 PM, said:

Just put the function under the class

It would be something like this:
Public Class FormName

	Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As IntPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		ShellExecute(Nothing, "open", "http://www.google.com", "", "", AppWinStyle.NormalFocus)
	End Sub

End Class



where do i put this.... i get errors?
Was This Post Helpful? 0
  • +
  • -

#6 Garrett92  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 10-July 06

Re: How To Open a webpage in Defualt Browesr

Posted 30 January 2008 - 04:53 PM

Try This.. with your old code:

btw... I'm using 2008, but I think It also worked on 2005

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As IntPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer

Private Sub cmdOpenBebo_Click()

ShellExecute(Nothing, "open", "http://www.google.com", "", "", AppWinStyle.NormalFocus)

End Sub

This post has been edited by Garrett92: 30 January 2008 - 04:54 PM

Was This Post Helpful? 0
  • +
  • -

#7 lump121  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 30-January 08

Re: How To Open a webpage in Defualt Browesr

Posted 30 January 2008 - 04:58 PM

View PostGarrett92, on 30 Jan, 2008 - 04:53 PM, said:

Try This.. with your old code:

btw... I'm using 2008, but I think It also worked on 2005

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As IntPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer

Private Sub cmdOpenBebo_Click()

ShellExecute(Nothing, "open", "http://www.google.com", "", "", AppWinStyle.NormalFocus)

End Sub


says
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As IntPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer



is a comment.... as need to be after end sub :(
Was This Post Helpful? 0
  • +
  • -

#8 Garrett92  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 10-July 06

Re: How To Open a webpage in Defualt Browesr

Posted 30 January 2008 - 05:05 PM

Well, other than that.. I don't know what the problem could be

But here was something that I posted a while back, this would be used to only open a website on a single browser though:

http://www.dreaminco...wtopic17141.htm
Was This Post Helpful? 0
  • +
  • -

#9 lump121  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 30-January 08

Re: How To Open a webpage in Defualt Browesr

Posted 30 January 2008 - 05:14 PM

View PostGarrett92, on 30 Jan, 2008 - 05:05 PM, said:

Well, other than that.. I don't know what the problem could be

But here was something that I posted a while back, this would be used to only open a website on a single browser though:

http://www.dreaminco...wtopic17141.htm




anyone got any other ideas none of this makes any sence.... how do you input the formname it gives me errors????? the form name is just extraButtons how i do this?

This post has been edited by lump121: 30 January 2008 - 05:19 PM

Was This Post Helpful? 0
  • +
  • -

#10 Garrett92  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 10-July 06

Re: How To Open a webpage in Defualt Browesr

Posted 30 January 2008 - 08:10 PM

I don't know if this may be the problem, but just try inserting this.
I set it up for your form, and I made it "Public Declare Function".
I tried it, and it still worked for me.

Public Class extraButtons

	Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As IntPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer

	Private Sub cmdOpenBebo_Click()
		ShellExecute(Nothing, "open", "http://www.google.com", "", "", AppWinStyle.NormalFocus)
	End Sub

End Class

Was This Post Helpful? 0
  • +
  • -

#11 lump121  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 30-January 08

Re: How To Open a webpage in Defualt Browesr

Posted 31 January 2008 - 03:18 AM

View PostGarrett92, on 30 Jan, 2008 - 08:10 PM, said:

I don't know if this may be the problem, but just try inserting this.
I set it up for your form, and I made it "Public Declare Function".
I tried it, and it still worked for me.

Public Class extraButtons

	Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As IntPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer

	Private Sub cmdOpenBebo_Click()
		ShellExecute(Nothing, "open", "http://www.google.com", "", "", AppWinStyle.NormalFocus)
	End Sub

End Class


hi thanks for setting this up but the public class extraButtons says is an expected end of statment?

and the ShellExecute(Nothing, "open", "http://www.google.com", "", "", AppWinStyle.NormalFocus) shows in red. thanks for this and all your help
Was This Post Helpful? 0
  • +
  • -

#12 lump121  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 30-January 08

Re: How To Open a webpage in Defualt Browesr

Posted 31 January 2008 - 03:31 AM

View Postlump121, on 31 Jan, 2008 - 03:18 AM, said:

View PostGarrett92, on 30 Jan, 2008 - 08:10 PM, said:

I don't know if this may be the problem, but just try inserting this.
I set it up for your form, and I made it "Public Declare Function".
I tried it, and it still worked for me.

Public Class extraButtons

	Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As IntPtr, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Integer) As Integer

	Private Sub cmdOpenBebo_Click()
		ShellExecute(Nothing, "open", "http://www.google.com", "", "", AppWinStyle.NormalFocus)
	End Sub

End Class


hi thanks for setting this up but the public class extraButtons says is an expected end of statment?

and the ShellExecute(Nothing, "open", "http://www.google.com", "", "", AppWinStyle.NormalFocus) shows in red. thanks for this and all your help


hi mate thanks for ya help but this seemed to work :D whitch is close they must of chaged uit for 2008 :(

 
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 cmdOpenBebo_Click()
	ShellExecute 0, vbNullString, "http://www.vbweb.co.uk/", vbNullString, vbNullString, vbNormalFocus
End Sub



the website is were i found it :P still mate i love u for helping me :P
Was This Post Helpful? 0
  • +
  • -

#13 dawmail333  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 27
  • View blog
  • Posts: 174
  • Joined: 02-July 07

Re: How To Open a webpage in Defualt Browesr

Posted 01 February 2008 - 06:20 AM

System.Diagnostics.Process.Start("URL") 

Opens it in the default browser.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1