Page 1 of 1
Web Browser Protocol
Posted: Thu Dec 02, 2010 3:51 pm
by frozerlaxegon
Erm, its been a longgg time since I've been here, so, what I wanted to do is to access my application from a url / webbrowser and accessing a function of it instead of just starting it.
Don't understand? Well, what I wanted to do is like when you type in Mbdn://<fileurlhere> it will open up my application with the <fileurlhere> then mbdn://about will open up the about page, is there any tutorials of doing so here?
Here's an
exampleof what I'm talking about
Re: Web Browser Protocol
Posted: Thu Dec 02, 2010 4:40 pm
by Agust1337
what you could do is...
WebBrowser1_DocumentCompleted
Code: Select allif textbox1.text.contains("mbdn://about") then
webbrowser1Document = My.Resources.about
end if
Maybe you could do that.
Re: Web Browser Protocol
Posted: Thu Dec 02, 2010 6:25 pm
by Codex
Agust1337 wrote:what you could do is...
WebBrowser1_DocumentCompleted
Code: Select allif textbox1.text.contains("mbdn://about") then
webbrowser1Document = My.Resources.about
end if
Maybe you could do that.
1) its webbrowser1.document, not webbrowser1Document
2) that wouldn't work, or it would but then it would display a "404" error, website not found and then redirected, so instead, have that code in your navigate/go button.
3) I don't think this is what he wants, he wants if you type in mbdn:// in any browser like FireFox, Google Chrome, etc. it would launch a application
Re: Web Browser Protocol
Posted: Thu Dec 02, 2010 9:48 pm
by Axel
CodexVideos wrote:Agust1337 wrote:what you could do is...
WebBrowser1_DocumentCompleted
Code: Select allif textbox1.text.contains("mbdn://about") then
webbrowser1Document = My.Resources.about
end if
Maybe you could do that.
1) its webbrowser1.document, not webbrowser1Document
2) that wouldn't work, or it would but then it would display a "404" error, website not found and then redirected, so instead, have that code in your navigate/go button.
3) I don't think this is what he wants, he wants if you type in mbdn:// in any browser like FireFox, Google Chrome, etc. it would launch a application
http://www.youtube.com
will launch a website with parameters "
www.youtube.com" :P
so i think it would be something like this
mbdn://D:\Users\file.txt
will for example delete the file that way or something idk what he will do with it
or
search://lol+lol = lol
(thats what i think he wants
heres a quick sample i made
Code: Select all Dim str As String
If TextBox1.Text.StartsWith("mbdn://") Then
str = TextBox1.Text.Remove(0, 7)
TextBox2.Text = str
WebBrowser1.Navigate("http://www.google.com/#sclient=psy&hl=en&site=&source=hp&q=" + str + "&aq=f&aqi=g1g-sv2&aql=&oq=&gs_rfai=&pbx=1&fp=64e74bf06843dcb7")
End If
when you type in "mbdn://lollo , the webbrowser will google "lollo" :P
idk if your problem is solved now
Re: Web Browser Protocol
Posted: Thu Dec 02, 2010 11:48 pm
by mandai
If you want to add a new protocol extension you can use this:
Code: Select all Dim rk As RegistryKey = Registry.ClassesRoot.CreateSubKey("mbdn")
rk.SetValue("URL Protocol", "")
rk = rk.CreateSubKey("shell").CreateSubKey("open").CreateSubKey("command")
rk.SetValue("", "C:\myApp.exe %1")
Then in your application you should process the arguments array to get the information.
Re: Web Browser Protocol
Posted: Mon Dec 06, 2010 5:32 am
by frozerlaxegon
*FACE PALM* Apply directly to forehead.
NO, U GUYS NO UNDERSTAND(RAWR) - LOLOLOLOL
Mandai gets it but I not quite understand it, mind explaining?
As for the other replies, I'm NOT developing a web browser goddamnit, I'm developing a music player application, and the url MUST be universal(meaning that if I type mbdn://slay@all in Firefox, it will slay all the slaves! -LOLOLOL and If I type in mbdn://slay@all in Internet Explorer it will also slay all the slaves!)
Mandai, I think u get my idea but mind explaining?
TOPIC NOT LOCKED - *GOES FOR A NICE FACEPALMING*
Re: Web Browser Protocol
Posted: Mon Dec 06, 2010 6:38 pm
by mandai
Lol we get a lot of webbrowsers around here so its easy to get mixed up with that.
First you need to change the last line from C:\myApp.exe to the path/filename of your program that you want to be launched. Basically you add this code to an event so it will install the protocol handler in the registry.
Then in your program's Load event you can use this code to see what address was used e.g. mdbn://example:
Code: Select all Dim args As String() = Environment.GetCommandLineArgs()
Dim address As String = ""
For i As Integer = 1 To args.Length - 1
address += args(i) & " "
Next
MsgBox(address)
I'm not sure what you want your app do when it gets the address but you could seperate the paramaters by splitting the string.
Re: Web Browser Protocol
Posted: Mon Dec 06, 2010 7:37 pm
by Codex
frozerlaxegon wrote:*FACE PALM* Apply directly to forehead.
NO, U GUYS NO UNDERSTAND(RAWR) - LOLOLOLOL
Mandai gets it but I not quite understand it, mind explaining?
As for the other replies, I'm NOT developing a web browser goddamnit, I'm developing a music player application, and the url MUST be universal(meaning that if I type mbdn://slay@all in Firefox, it will slay all the slaves! -LOLOLOL and If I type in mbdn://slay@all in Internet Explorer it will also slay all the slaves!)
Mandai, I think u get my idea but mind explaining?
TOPIC NOT LOCKED - *GOES FOR A NICE FACEPALMING*
I understood,
3) I don't think this is what he wants, he wants if you type in mbdn:// in any browser like FireFox, Google Chrome, etc. it would launch a application
Well, i think mandai's code works.