A recent project to click on a link on the Web page to start their own program, but also to receive parameters, Google for 1.5 hours, finally the preliminary test passed.
Try Google: web Send message Windows Form, BS call CS program, custom Protocol ... Multiple keyword combinations to find this technique called
Registered URL protocol, in this article is described in more detail:
http://msdn.microsoft.com/en-us/library/aa767914 (v=vs.85). aspx
1) First write a test program:
usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespacealert{classProgram {Static stringProcessInput (strings) {//TODO Verify and validate the input//string as appropriate for your application. returns; } Static voidMain (string[] args) {Console.WriteLine ("Alert.exe invoked with the following parameters.\r\n"); Console.WriteLine ("Raw command-line: \n\t"+environment.commandline); Console.WriteLine ("\n\narguments:\n"); foreach(stringSinchargs) {Console.WriteLine ("\ t"+ProcessInput (s)); } Console.WriteLine ("\npress any key to continue ..."); Console.readkey (); } }}
I compiled the program into Edss.exe.
2) Edit a file with Notepad and rename it to Edss.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\EDSS]
@= "Url:edss Protocol"
"URL Protocol" = ""
[Hkey_classes_root\edss\defaulticon]
@= "\" D:\\alert\\edss.exe\ ""
[Hkey_classes_root\edss\shell]
[Hkey_classes_root\edss\shell\open]
[Hkey_classes_root\edss\shell\open\command]
@= "\" d:\\alert\\edss.exe\ "\"%1\ ""
After running Edss.reg, always prompt some registry entries to write unsuccessfully, tossing a half-day, looking at the definition of HTTP and other protocols, finally found to be 360 in interference.
Turn off 360 security guard, the registry finally write successfully!
It turned out to be 360 security guard. Prevents the last registry entry from being written to:
[Hkey_classes_root\edss\shell\open\command]
@= "\" d:\\alert\\edss.exe\ "\"%1\ ""
3) Enter Edss://hello,ie browser in IE to strike a security Warning window, confirm and start my application normally
4) After trying unsuccessfully in Chrome, it was found that in chrome it was not possible to enter Edss://hello directly to start, and an HTML page had to be written.
Immediately wrote a line of HTML page: <a href= ' Edss://hello ' > Start my Windows program </a>
Chrome can also start my Windows program!
Other browsers try again later.