Web Browser Protocol

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
8 posts Page 1 of 1
Contributors
User avatar
frozerlaxegon
Top Poster
Top Poster
Posts: 84
Joined: Thu May 13, 2010 4:38 pm

Web Browser Protocol
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
Last edited by frozerlaxegon on Wed Dec 08, 2010 1:49 am, edited 1 time in total.
You've been RICKROLL'D
User avatar
Agust1337
Coding God
Coding God
Posts: 2456
Joined: Fri Feb 19, 2010 8:18 pm

Re: Web Browser Protocol
Agust1337
what you could do is...
WebBrowser1_DocumentCompleted
Code: Select all
if textbox1.text.contains("mbdn://about") then
webbrowser1Document = My.Resources.about
end if
Maybe you could do that.
Top-notch casual Dating
User avatar
Codex
Coding God
Coding God
Posts: 2028
Joined: Wed Mar 31, 2010 5:50 pm

Re: Web Browser Protocol
Codex
Agust1337 wrote:
what you could do is...
WebBrowser1_DocumentCompleted
Code: Select all
if 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
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
User avatar
Axel
Coding God
Coding God
Posts: 1928
Joined: Sun Jun 27, 2010 9:15 pm

Re: Web Browser Protocol
Axel
CodexVideos wrote:
Agust1337 wrote:
what you could do is...
WebBrowser1_DocumentCompleted
Code: Select all
if 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
http://vagex.com/?ref=25000
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Web Browser Protocol
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.
User avatar
frozerlaxegon
Top Poster
Top Poster
Posts: 84
Joined: Thu May 13, 2010 4:38 pm

Re: Web Browser Protocol
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*
You've been RICKROLL'D
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

Re: Web Browser Protocol
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.
User avatar
Codex
Coding God
Coding God
Posts: 2028
Joined: Wed Mar 31, 2010 5:50 pm

Re: Web Browser Protocol
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.
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
8 posts Page 1 of 1
Return to “Tutorial Requests”