url launch from inside Windows Form

I'm creating a program, but I need to make a button that will take me to a site.

I need it to be youtube in this case.


How do I do that simply?
==================
Also how do you create an internet shortcut desktop link using ofstream?

Thanks!
Visual C++? Unless there's some VC-specific keyword for shelling external commands I'd just go with ShellExecute.
http://msdn.microsoft.com/en-us/library/bb762153(v=vs.85).aspx

As for creating an internet shortcut, refer to this:
http://delphi.about.com/od/internetintranet/a/lnk-shortcut.htm
Last edited on
The making shorcuts I understand the first link though.... Holy crap! I don't understand that. if it's not too much trouble what would I do for a button click event in visual Studio 2010?:

1
2
3
4
5
#pragma endregion
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
			 {
                                  //Not Sure What To Put Here
			 }

All you have to do is create a .URL file, and then write

1
2
[InternetShortcut]
URL=http://google.com 


to it, replacing http://google.com with your URL.

EDIT: I can't tell what language that is, so I can't help you with the actual code, sorry. Is that C#?
Last edited on
The language is C++/CLR .

Use System::Diagnostics::Process::Start to open a web page.

Example Code:

1
2
3
4
5
#pragma endregion
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
				 System::Diagnostics::Process::Start("http://www.google.com");
			 }
	};


In order to create a shortcut use a StreamWriter.

Example Code:

1
2
3
4
5
6
7
String^ ShortcutName="Google.url";
String^ ShortcutPath=Environment::GetFolderPath(Environment::SpecialFolder::Desktop)+"\\"+ShortcutName;
String^ URL="http://www.google.com";
System::IO::StreamWriter^ Writer=gcnew System::IO::StreamWriter(ShortcutPath,false);
Writer->WriteLine("[InternetShortcut]");
Writer->Write("URL="+URL);
Writer->Close();


This creates a shortcut to google.com on the desktop.
Topic archived. No new replies allowed.